From: Boaz Harrosh <bharrosh@panasas.com>
To: Peter Krefting <peter@softwolves.pp.se>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: Recovering from commit --amend in rebase --interactive
Date: Tue, 01 Jun 2010 12:48:58 +0300 [thread overview]
Message-ID: <4C04D78A.2090103@panasas.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1006011022030.2352@ds9.cixit.se>
On 06/01/2010 12:27 PM, Peter Krefting wrote:
> Hi!
>
> I am a frequent user of rebase --interactive, and sometimes I do change a
> commit to "edit", which presents me with an already committed change, which
> I can fix up, and do "git commit --amend" on.
>
> However, sometimes I get conflicts during rebase. In some cases I have
> already seen that conflict, so rerere handles it for me. I am still dropped
> out of rebase to manually add the fixes, though.
>
> The problem now is that is way too easy to just do a "git commit --amend"
> like in the case above, and thus overwriting the previous commit
> unintentionally.
>
The prints are clear enough.
If stop do to "edit" then it prints ... you do:
git commit --amend
git rebase --continue
If stop do to merge-conflict it prints ... you do:
git add ... (Note no commit command)
git rebase --continue
You should be getting used to it after a while, I promise you
> Is there an easy way of working around the issue?
>
>
> Last time this happened to me, I *did* notice my mistake as I entered the
> editor, since it came up with the previous commit's message. However, as the
> commit message file was in a good shape, I found no way to break out of the
> amend.
What?!? no, why. Just empty out the message at editor and save. It will abort
any commit and do nothing.
(For example with kwrite, ctrl-a, delete, ctrl-s, exit)
It does not matter if the commit as entered some default text for you or
not. When editor is done if file is empty (or all comments) then it will
abort and do nothing. Do not worry. The original commit is un affected.
The message is just extracted from the original commit put to a tmp file
and enter into editor. (its just a commit -c after all)
> I ended up using "git reflog" to find out what I overwrote, then "git
> diff $commitid > savedpatch" to remember what the change that I mistakenly
> amended was, then "git checkout $commitid" and "git apply savedpatch" and
> "git add" on the changed files. What I am wondering if there is an easier
> way of recovering?
>
Boaz
next prev parent reply other threads:[~2010-06-01 9:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-01 9:27 Recovering from commit --amend in rebase --interactive Peter Krefting
2010-06-01 9:48 ` Boaz Harrosh [this message]
2010-06-01 10:40 ` Peter Krefting
2010-06-01 9:57 ` Jan Krüger
2010-06-01 15:25 ` Ævar Arnfjörð Bjarmason
2010-06-02 23:37 ` Junio C Hamano
2010-06-03 5:54 ` Ævar Arnfjörð Bjarmason
2010-06-01 15:07 ` Gabriel Filion
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=4C04D78A.2090103@panasas.com \
--to=bharrosh@panasas.com \
--cc=git@vger.kernel.org \
--cc=peter@softwolves.pp.se \
/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.