git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Holger Hellmuth <hellmuth@ira.uka.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>,
	kusmabite@gmail.com, Git Mailing List <git@vger.kernel.org>
Subject: Re: git add -p and unresolved conflicts
Date: Thu, 29 Mar 2012 03:32:23 +0200	[thread overview]
Message-ID: <4F73BBA7.6030009@ira.uka.de> (raw)
In-Reply-To: <7vk424s52z.fsf@alter.siamese.dyndns.org>

Am 29.03.2012 01:01, schrieb Junio C Hamano:
> There is a crucial step missing.  After running "cherry-pick --no-commit",
> you would eyeball the result, and typically edit the file.  The conflict
> may not be in the part of the file you are interested in picking, in which
> case you may even leave that part as-is.  And then, you would pick what
> you want to apply to the index during per-hunk interactive patching
> session.

But that changes nothing. To make it clear: We have a file with chunks 
A, B and C. Only B is conflicting, but the user wants to add A or an 
edited A´ . And maybe also a new edit D.

When he calls "git add -p", he gets presented with B. By picking the 
"ours" option (aka "<") he gets the version in HEAD, resolving the 
conflict and thereby allowing the add. Next he will be presented with A 
(or A´) where he can type in "y" and C where he can type in "n".

Result: chunk A is added, C not, and B doesn't change from HEAD. Note he 
had the option to use ">" instead if it was B he wanted to cherry-pick.

The same happens if he further edited somewhere else to produce chunk D. 
Again, after resolving the conflict of B, he is presented with A,B and D 
and can add these chunks with "y" or not with "n".

The only case I haven't talked about now is if he edits B, but that is 
the trivial case because he would normally remove the conflict markers 
as well and git add -p would work conflict-free after the edit.

> In other words,...
>
>> git init .
>> echo "foo">  bar.txt
>> git add bar.txt
>> git commit -m.
>> git checkout -b new
>> echo "bar">>  bar.txt
>> git commit -am.
>> git checkout master
>> git reset --hard
>> echo "baz">>  bar.txt
>> git commit -am.
>> git cherry-pick --no-commit new
>
> Here, there *will* be "edit bar.txt" before "add -p".

  parent reply	other threads:[~2012-03-29  1:32 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-28  9:51 git add -p and unresolved conflicts Erik Faye-Lund
2012-03-28 15:10 ` Junio C Hamano
2012-03-28 15:21   ` Matthieu Moy
2012-03-28 19:14     ` Holger Hellmuth
2012-03-28 19:19       ` Junio C Hamano
2012-03-28 19:52         ` Holger Hellmuth
2012-03-29  6:08           ` Jeff King
2012-03-29 10:19             ` Holger Hellmuth
2012-03-28 19:38       ` Matthieu Moy
2012-03-28 19:54         ` Junio C Hamano
2012-03-28 20:10         ` Holger Hellmuth
2012-03-28 20:50           ` Junio C Hamano
2012-03-28 22:50             ` Holger Hellmuth
2012-03-28 23:01               ` Junio C Hamano
2012-03-28 23:05                 ` Junio C Hamano
2012-03-29  1:32                 ` Holger Hellmuth [this message]
2012-03-29  7:26           ` Matthieu Moy
2012-03-29 21:08             ` Junio C Hamano
2012-03-30  8:11               ` Matthieu Moy
2012-03-28 15:33   ` Erik Faye-Lund
2012-03-28 17:17     ` Junio C Hamano

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=4F73BBA7.6030009@ira.uka.de \
    --to=hellmuth@ira.uka.de \
    --cc=Matthieu.Moy@grenoble-inp.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=kusmabite@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 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).