From: Phil Hord <hordp@cisco.com>
To: "git@vger.kernel.org" <git@vger.kernel.org>
Cc: Phil Hord <phil.hord@gmail.com>
Subject: Stash during incomplete merge
Date: Sun, 26 Feb 2012 13:36:55 -0500 [thread overview]
Message-ID: <4F4A7BC7.5010702@cisco.com> (raw)
Hi list,
I was cherry-picking changes from an old branch recently when I ran into
unexpected behavior with git stash pop. When I git-stash-save after
resolving a merge-conflict, the subsequent git-stash-pop does not
restore my index.
I think it is the same problem being asked about here:
http://stackoverflow.com/questions/9009354/git-stash-during-a-merge-conflict
Is this expected behavior or a bug?
<http://stackoverflow.com/questions/9009354/git-stash-during-a-merge-conflict>Here's
a script the demonstrates the anomaly, but my actual encounter involved
more files, some of which I added to the index and some I did not:
# Create a sample merge-conflict
git init tmp-repo && cd tmp-repo
echo foo > foo.txt && git add foo.txt && git commit -m "foo"
git checkout -b A master && echo foo-A > foo.txt && git commit -am "foo-A"
git checkout -b B master && echo foo-B > foo.txt && git commit -am "foo-B"
git merge A
git status
# Resolve the conflict
echo foo-AB > foo.txt && git add foo.txt
git status
git stash
# test test test... Resume...
git stash pop
Here's some of the final output:
$ git merge A
Auto-merging foo.txt
CONFLICT (content): Merge conflict in foo.txt
Recorded preimage for 'foo.txt'
Automatic merge failed; fix conflicts and then commit the result.
$ git status
# On branch B
# Unmerged paths:
# (use "git add/rm <file>..." as appropriate to mark resolution)
#
# both modified: foo.txt
#
no changes added to commit (use "git add" and/or "git commit -a")
$ # Resolve the conflict
$ echo foo-AB > foo.txt && git add foo.txt
$ git status
# On branch B
# Changes to be committed:
#
# modified: foo.txt
#
$ # Now foo.txt is in my index. But I have to test something before I
commit.
$ git stash
Saved working directory and index state WIP on B: 80f2a13 foo-B
HEAD is now at 80f2a13 foo-B
$ # test test test... Resume...
$ git stash pop
# On branch B
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working
directory)
#
# modified: foo.txt
#
no changes added to commit (use "git add" and/or "git commit -a")
Dropped refs/stash@{0} (460a6d5c67a3db613fd27f1854ecc7b89eeaa207)
next reply other threads:[~2012-02-26 18:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-26 18:36 Phil Hord [this message]
2012-02-28 20:22 ` Stash during incomplete merge Neal Kreitzinger
2012-02-28 22:24 ` Neal Kreitzinger
2012-02-29 19:34 ` Neal Kreitzinger
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=4F4A7BC7.5010702@cisco.com \
--to=hordp@cisco.com \
--cc=git@vger.kernel.org \
--cc=phil.hord@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).