From: John Szakmeister <john@szakmeister.net>
To: Git mailing list <git@vger.kernel.org>
Subject: 'git checkout -p' is a bit confusing...
Date: Mon, 9 May 2011 06:05:49 -0400 [thread overview]
Message-ID: <BANLkTik+VbJZKc1Xwb-3p3HPW-zxanc7HQ@mail.gmail.com> (raw)
I noticed this a little while back, but thought it may have been my
own misunderstanding. I wanted to selectively revert part of a file,
so I used 'git checkout -p filename'. Then I needed to edit the hunk,
and got something like this:
# Manual hunk edit mode -- see bottom for a quick guide
@@ -236,6 +236,12 @@ int run_add_interactive(const char *revision,
const char *patch_mode,
}
args[ac] = NULL;
+ for (i=0; i < ac; i++)
+ {
+ fprintf(stderr, "%s ", args[i]);
+ }
+ fprintf(stderr, "\n");
+
# ---
# To remove '+' lines, make them ' ' lines (context).
# To remove '-' lines, delete them.
# Lines starting with # will be removed.
#
# If the patch applies cleanly, the edited hunk will immediately be
# marked for discarding. If it does not apply cleanly, you will be given
# an opportunity to edit again. If all lines of the hunk are removed,
# then the edit is aborted and the hunk is left unchanged.
Since the diff was showing me the forward direction (from the base to
modified working tree), I expected that when I left the +'s in there,
that it was going to leave my hunk. Unfortunately, it discarded my
hunk. I can see the text at the bottom, and now it makes sense, but I
wonder if there's a way to make it so that you can edit the patch to
look the way you want, and keep those bits (in much the same way as
'git add -p' works)?
I hope that makes sense. :-)
Thank you!
-John
next reply other threads:[~2011-05-09 10:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-09 10:05 John Szakmeister [this message]
2011-05-09 10:57 ` 'git checkout -p' is a bit confusing Jeff King
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=BANLkTik+VbJZKc1Xwb-3p3HPW-zxanc7HQ@mail.gmail.com \
--to=john@szakmeister.net \
--cc=git@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).