Skip to content

improving "git stash list -p"

Jeff King git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2add --simplify-combined-diff optionDocumentation/rev-list-options.txt combine-diff.c revision.c +2 more+173 -41 reply
2/2stash: default listing to "--cc --simplify-combined-diff"git-stash.sh t/t3903-stash.sh+65 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] improving "git stash list -p"

Imagine you have a simple stash like:

git init
echo base >file && git add file && git commit -m file echo new >file
git stash

Before this series:

  $ git stash list -p
  stash@{0}: WIP on master: 7a1fd22 file

Er, what? It didn't give me a patch. Oh, that's because stashes are merge commits, and we need to tell it how to handle merges.

  $ git stash list -p --cc
  stash@{0}: WIP on master: 7a1fd22 file
  diff --cc file
  index df967b9,df967b9..3e75765
  --- a/file
  +++ b/file
  @@@ -1,1 -1,1 +1,1 @@@
  --base
  ++new

Better, though the combined diff is useless, since I didn't touch the index at all. Here it is after this series:

  $ git stash list -p
  stash@{0}: WIP on master: 7a1fd22 file
  diff --cc file
  index df967b9..3e75765
  --- a/file
  +++ b/file
  @@ -1,1 +1,1 @@
  -base
  +new

Ah, a nice readable diff with no hassle.

  [1/2]: add --simplify-combined-diff option
  [2/2]: stash: default listing to "--cc --simplify-combined-diff"

-Peff