Fixing Corrupt Git Branch

From eqqon

(Difference between revisions)
Jump to: navigation, search
m (New page: 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...)
m
 
Line 1: Line 1:
-
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)
+
Say, you corrupted your github repository (i.e. by playing around with the fork queue =P) 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):
Reset local head to that commit (replace xxxx with commit hash):

Latest revision as of 12:56, 3 August 2009

Say, you corrupted your github repository (i.e. by playing around with the fork queue =P) 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