All of lore.kernel.org
 help / color / mirror / Atom feed
From: Piotr Krukowiecki <piotr.krukowiecki@gmail.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: git@vger.kernel.org, Johan Herland <johan@herland.net>,
	Christian Couder <chriscool@tuxfamily.org>
Subject: Re: [PATCH] cherry-pick: when pick fails, explain how to cancel
Date: Fri, 18 Feb 2011 22:38:03 +0100	[thread overview]
Message-ID: <4D5EE6BB.9070507@gmail.com> (raw)
In-Reply-To: <20110218012435.GA16893@elie>

W dniu 18.02.2011 02:24, Jonathan Nieder pisze:
> Piotr Krukowiecki wrote:
>> 1. add hint to cherry-pick how to abort merge, for example:
>>    hint: use 'git reset --merge ORIG_HEAD' to abort merge
> 
> Good idea.  "git cherry-pick" does not set ORIG_HEAD, so I
> put "git reset --merge HEAD" instead.

You're right. I was sure I have tested it, but when I try to 
use ORIG_HEAD now it does not work.

I took it from Documentation/git-cherry-pick.txt, which seem
to be wrong:

   $ git cherry-pick topic^             <1>
   $ git diff                           <2>
   $ git reset --merge ORIG_HEAD        <3>
   [...]
   <3> cancel the cherry-pick.  In other words, return to the
   pre-cherry-pick state, preserving any local modifications you had in
   the working tree.


>> 2. add hint to status how to abort merge, for example:
>>    #   (use 'git reset --merge ORIG_HEAD' to abort merge)
> 
> "git reset --merge" will remove local changes marked with "git add",
> under the assumption that they were part of the conflict resolution
> and thus should be cleared away.

Didn't know that (one probably shouldn't merge with uncommitted/local
changes anyway). git-reset.txt mentions it, but there's no explicit
warning.


> This leaves me afraid of the following scenario:
> 
> 	git pull
> 	# conflict?  agh!
> 
> 	# ... two days later ...
> 	... hack hack hack ...
> 	... add add add ...
> 	git commit;	# fails because of unmerged files
> 
> 	# whoops, forgot about that merge.
> 	# Let's do what it says to do:
> 	git reset --merge ORIG_HEAD
> 
> It seems safest to only recommend "reset --merge" immediately
> after a mergy operation.

Is it possible to recognize that you have something more than what
was cause by the merge/cherry-pick?


>> The ORIG_HEAD is specified in man page example.
> 
> I assume you mean on the git-reset page?  It might be nice to add
> more examples and to update the current ones with current best
> practice (e.g., using reset --keep more often).

Yes, it says:

   Running "git reset --hard ORIG_HEAD" will let you go back to where
   you were, but it will discard your local changes, which you do not
   want.  "git reset --merge" keeps your local changes.

 
>> git-cherry-pick uses word "cancel" in man page (in example) and
>> git-merge uses word "abort" for (as I understand) the same action.
> 
> Hmm, where is this example in the cherry-pick manpage?

It's in the Documentation/cherry-pick.txt (in current master). I assume 
man pages are generated from those text files. I have also cited it at 
the beginning of this mail.


-- 
Piotr Krukowiecki

  reply	other threads:[~2011-02-18 21:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-16  9:16 Aborting cherry-pick Piotr Krukowiecki
2011-02-18  1:24 ` [PATCH] cherry-pick: when pick fails, explain how to cancel Jonathan Nieder
2011-02-18 21:38   ` Piotr Krukowiecki [this message]
2011-02-18 23:17     ` [PATCH] Documentation: cherry-pick does not set ORIG_HEAD Jonathan Nieder
2011-02-19 20:13       ` Piotr Krukowiecki

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=4D5EE6BB.9070507@gmail.com \
    --to=piotr.krukowiecki@gmail.com \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=johan@herland.net \
    --cc=jrnieder@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.