Fixing Corrupt Git Branch

From eqqon

Revision as of 12:54, 3 August 2009 by Henon (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Say you corrupted your branch and want to reset your remote repository to a certain point in your history that is still ok (commit with hash xxxx)

Reset local head to that commit (replace xxxx with commit hash):

git reset --hard xxxx

Delete corrupt remote branch

git push origin :master

Recreate remote branch with your fixed one

git push origin master