Re: [RFC] Reverting individual files to HEAD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Matthieu Moy <Matthieu.Moy@xxxxxxx> wrote:
> What's the best way to revert individual files with git?

git checkout HEAD -- fileA
 
> To revert a whole tree, I can use "git reset --hard", but it refuses
> to do a partial reset.

Yes.

> At the moment, I use either
> 
> $ git diff file | patch -R -p1
> 
> or
> 
> $ git show HEAD:file > file
> 
> (followed by git-add file in both cases)
> 
> I realize I can also do
> 
> $ git reset HEAD file
> $ git checkout file

All of those also work, but as you said, are less fun to type.  :-)

-- 
Shawn.
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux