TransWikia.com

Remove some commits permanently from forked master repo and sync with main repo

Stack Overflow Asked by srinath on January 31, 2021

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 ?

One Answer

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

Answered by matt on January 31, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP