Git How to Fix Local Divercence After Remove/Undo A Remote Commit

October 31, 2011 | By Duchateaux.

After you Removed a Commit from a Remote Repository you will need to Replicate the Remote State Locally…
If for Example you Removed a Commit from your .git Remote Repo with:

git reset --hard HEAD^

Your Local Repository will be Ahead of 1 Commit without to Perceive that…
In fact if you Execute Locally a:

git status

The output will continue to show you 1 more Commit with respect to your Remote Repo but
will give you the State As Up To Date.
To Correct this Local Divergence you simply perform a Forced pull from HEAD:master
/nand this will Correct and Match the Remote State Locally.
So to Fix the Divergence between Local and Remote when Locally you have some more Commits than Remotelly, you just perform a Fetch and Rebase:

git commit -a
git fetch
git rebase origin

QuickChic Theme • Powered by WordPress