From: Jonathan Nieder <jrnieder@gmail.com>
To: Jon Seymour <jon.seymour@gmail.com>
Cc: Eugene Sajine <euguess@gmail.com>,
David Borowitz <dborowitz@google.com>,
git@vger.kernel.org
Subject: Re: Proper way to abort incorrect cherry-picking?
Date: Wed, 28 Apr 2010 18:37:58 -0500 [thread overview]
Message-ID: <20100428233758.GA1654@progeny.tock> (raw)
In-Reply-To: <o2j2cfc40321004281539j28fe44e0r5d029061e3e08b90@mail.gmail.com>
Hi Jon,
Jon Seymour wrote:
> If you use git reset --mixed HEAD@{1} you can reset the index to
> HEAD@{1} to reflect the pre-merge state.
The HEAD doesn’t advance in a failed merge, right?
[...]
> This is more complicated than it needs to be - if you had stashed (or
> committed) before cherry picking, things would be simpler.
If this were really necessary, I would consider it a bug.
I do think recovery is more complicated than it needs to be, since one
has to check whether the merge/cherry-pick failed before cancelling
it. There are three cases.
- If an early check prevented the operation (message with “fatal:”,
status = 128), then the index and work tree were not touched.
No recovery required.
- If there were conflicts (message with “Conflicts:”, status = 1),
the index will record the competing versions of conflicted files,
and the work tree will represent the situation with conflict
markers.
Use ‘git reset --merge’ to recover.
- If the merge proceeded cleanly (status = 0), but it was a bad
idea after all, the index and work tree record the new version now.
Use ‘git reset --keep HEAD@{1}’ to undo the operation.
Have fun,
Jonathan
next prev parent reply other threads:[~2010-04-28 23:38 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-28 19:38 Proper way to abort incorrect cherry-picking? Eugene Sajine
2010-04-28 19:49 ` David Borowitz
2010-04-28 19:59 ` Eugene Sajine
2010-04-28 22:39 ` Jon Seymour
2010-04-28 23:37 ` Jonathan Nieder [this message]
2010-04-29 0:07 ` Jon Seymour
2010-04-29 19:11 ` git cherry(pick) dumps core Andreas Krey
2010-04-29 19:49 ` Jonathan Nieder
2010-04-29 20:21 ` Andreas Krey
2010-04-30 13:32 ` Jonathan Nieder
2010-05-08 23:17 ` [PATCH] cherry-pick: do not dump core when iconv fails Jonathan Nieder
2010-05-08 23:55 ` Junio C Hamano
2010-04-28 19:50 ` Proper way to abort incorrect cherry-picking? Jonathan Nieder
2010-04-28 20:05 ` Eugene Sajine
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=20100428233758.GA1654@progeny.tock \
--to=jrnieder@gmail.com \
--cc=dborowitz@google.com \
--cc=euguess@gmail.com \
--cc=git@vger.kernel.org \
--cc=jon.seymour@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.