threads / discuss / 10406

how to deal with conflicts after "git stash apply"?

Subject: how to deal with conflicts after "git stash apply"?

## tl;dr

4 messages between Oct 21, 2007 and Oct 22, 2007.

replies: 3people: 3as markdown or json

Scott Parish· Oct 21, 2007, 22:32 UTC · lore

How is the intended way to deal with "git stash apply" conflicts? If i just edit the file and remove the conflict, "git diff" gives some really messed up output. Documentation for other commands and conflicts suggest "git commit" after cleaning up the conflict, or "git add", but in the case of "stash apply" i'm not ready for a commit yet, and "git add" keeps "git diff" from showing any output.

Thanks for any clarification sRp

-- 
Scott Parish
http://srparish.net/
Johannes Schindelin· Oct 21, 2007, 22:40 UTC · re: Scott Parish · lore

Re: how to deal with conflicts after "git stash apply"?

Hi,
On Sun, 21 Oct 2007, Scott Parish wrote:
Show 6 quoted lines
> How is the intended way to deal with "git stash apply" conflicts?
> If i just edit the file and remove the conflict, "git diff" gives
> some really messed up output. Documentation for other commands and
> conflicts suggest "git commit" after cleaning up the conflict, or
> "git add", but in the case of "stash apply" i'm not ready for a
> commit yet, and "git add" keeps "git diff" from showing any output.
You are probably seeing combined diffs.

This show not only the differences of the working tree relative to HEAD, but also of the changes stored in the stash.

You should have a look into Documentation/diff-format.txt (section "combined diff format") to learn more.

Hth, Dscho

Shawn O. Pearce· Oct 22, 2007, 04:26 UTC · re: Johannes Schindelin · lore

Re: how to deal with conflicts after "git stash apply"?

Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
Show 13 quoted lines
> On Sun, 21 Oct 2007, Scott Parish wrote:
> 
> > How is the intended way to deal with "git stash apply" conflicts?
> > If i just edit the file and remove the conflict, "git diff" gives
> > some really messed up output. Documentation for other commands and
> > conflicts suggest "git commit" after cleaning up the conflict, or
> > "git add", but in the case of "stash apply" i'm not ready for a
> > commit yet, and "git add" keeps "git diff" from showing any output.
> 
> You are probably seeing combined diffs.
> 
> This show not only the differences of the working tree relative to HEAD, 
> but also of the changes stored in the stash.

The reason Scott is seeing a combined diff here is merge-recursive left the different versions of the file in the higher order stages of the index when it found conflicts during the apply. You need to use git-add to stage the resolved file and replace the higher order stages with just the normal stage 0.

-- 
Shawn.
Scott Parish· Oct 22, 2007, 04:39 UTC · re: Johannes Schindelin · lore

Re: how to deal with conflicts after "git stash apply"?

> You should have a look into Documentation/diff-format.txt (section 
> "combined diff format") to learn more.

Ah, thanks for the pointer; i hadn't realized that this wasn't standard diff format. With this and what Shawn said, it all makes sense now.

sRp
-- 
Scott Parish
http://srparish.net/

← back to recent threads