From: Michael J Gruber <git@drmicha.warpmail.net>
To: Dario Rodriguez <soft.d4rio@gmail.com>
Cc: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
"Thomas Ferris Nicolaisen" <tfnico@gmail.com>,
git@vger.kernel.org
Subject: Re: Revert a single commit in a single file
Date: Fri, 25 Feb 2011 14:05:49 +0100 [thread overview]
Message-ID: <4D67A92D.2000300@drmicha.warpmail.net> (raw)
In-Reply-To: <AANLkTimqszvGjVeJHKLPWicDugeOuqbgO1+wy5BO-AE0@mail.gmail.com>
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?]
next prev parent reply other threads:[~2011-02-25 13:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-25 10:34 Revert a single commit in a single file Thomas Ferris Nicolaisen
2011-02-25 11:17 ` Ævar Arnfjörð Bjarmason
2011-02-25 12:37 ` Michael J Gruber
2011-02-25 12:48 ` Dario Rodriguez
2011-02-25 13:05 ` Michael J Gruber [this message]
2011-02-25 14:38 ` Thomas Ferris Nicolaisen
2011-02-25 15:19 ` Dario Rodriguez
2011-02-25 18:53 ` Junio C Hamano
2011-02-25 19:43 ` Ævar Arnfjörð Bjarmason
2011-02-25 19:54 ` Junio C Hamano
2011-02-25 20:05 ` Ævar Arnfjörð Bjarmason
2011-02-25 20:22 ` Jay Soffian
2011-02-26 0:27 ` Dario Rodriguez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D67A92D.2000300@drmicha.warpmail.net \
--to=git@drmicha.warpmail.net \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=soft.d4rio@gmail.com \
--cc=tfnico@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.