Re: Revert a single commit in a single file

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

 



Dario Rodriguez venit, vidit, dixit 25.02.2011 13:48:
> The most sensible way to do this seems to be:

To do what? I you hadn't top posted we would know what "this" referred to.

>  git checkout HEAD~2 file.c
> 
> And your index will show file.c modified, as it will have it's content
> reverted 2 commits.

It will have its content reset to what it was in HEAD~2. This is very
different from reverting the change made in HEAD~2:

> The behavior of 'revert' is to revert commits, not files, so it's not
> expected to work if you say 'git revert <commit> <path>'

It makes perfect sense, it's just not implemented.

Note that you can also

git show <commit> -- <path> | git apply -R

to achieve a partial revert. That might be the easiest route to take.

Michael

[Cutting the bottom copy - what is it good for there?]
--
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]