Recovering a patch accidentally removed by git reset

Mike McCormack mike at codeweavers.com
Wed Sep 20 05:55:20 CDT 2006


Jeff L wrote:
> How do you get a patch back that you have managed to remove completely 
> from your system with a
> git reset HEAD^
> git reset
> git checkout patchname ?
> 
> git fetch does not seem to refresh the patch from the repository.  I was 
> going fairly well with git then stuffed this up.

If the patch you "uncommitted" with "git reset" is your own, you can 
search for it with "git fsck-objects".  That will give you a list of 
SHA1 commit IDs (and perhaps other objects).  You can check what is in 
each commit with "git log SHA1ID".

If you've just "uncommitted" one of Alexandre's commits, first make sure 
that you have the master branch checked out:

bash-2.05b$ git branch
* master
   origin

Unless you've made more branches, "master" is your, and "origin" is 
Alexandre's.

Then try:

git checkout master
git rebase origin

That should bring your "master" back in line with the "origin" branch.

I did a presentation on Git at wineconf, you can see it here:

http://mandoo.dyndns.org/git-presentation/git-wine.html

Mike



More information about the wine-devel mailing list