On Monday, February 14, 2011 12:14:15 PM UTC+1, Thomas Ferris Nicolaisen 
> So I have an old file repo/foo.txt
> foo.txt has undergone many changes over the years.
> Recently, I changed something in commit Z.
> Later on, others changed foo.txt again in commits Y, X.
> Now, I've been put to the task of "undoing" the changes I made to foo.txt 
> in commit Z.
> I changed other files as well in commit Z, so I can't do git revert Z.
> The Google answer is to do git checkout Z^ (the commit before Z). But then 
> I lose the changes committed in Y and X.
Try 'git checkout Z^ foo.txt'. 
That will put foo.txt into the state of Z^ ready to commit (all changes 
already staged).

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to