Reputation: 2998
Main Repo - A
I forked a repo B from main repo A.
I wrote some code and accidentally pushed it in forked repo (B) - master branch and then i reverted the commit as well.
Now, whenever i create a branch from forked repo (B) , i am getting those 2 commits (the one which i created and reverted). Is there any way to get rid of two commits and overwrite the entire master branch and sync it with the parent/Main repo.
Or is there any way to simply ignore this fork and create another fork from the same id ?
Upvotes: 0
Views: 457
Reputation: 535954
Is there any way to get rid of two commits
Yes:
git reset --hard master~2
If you want the fork to look like that too:
git push --force
Upvotes: 3