23

Is there a way in SourceTree to see the whole content of a stash?

I have stashed quite a bunch of changes that are not yet ready to be committed on the Develop branch in order to checkout the Master branch for a hotfix. Now I realize that one change in the stash would be good to include in the hotfix since I will anyway have to make a new deployment. But since the stash is largish, I cannot see the particular change I want when I select the stash in SourceTree. For me, SourceTree shows only a part of the stash as some kind of summary...

I know that I can get around this in several different ways, but if there is an option somewhere that I don't know of which would make SourceTree show the full contents of the stash, I'd be very pleased if someone could tell me where to find it.

The repository is a GIT repository if that makes a difference...

BJ Myers
  • 6,617
  • 6
  • 34
  • 50
user1429080
  • 9,086
  • 4
  • 31
  • 54

3 Answers3

26

Can be fixed (in latest version?) by increasing the Max File Count and Max Diff Line Count in the Tools > Options > Diff:

enter image description here

huysentruitw
  • 27,376
  • 9
  • 90
  • 133
  • 1
    For anyone wondering, the upper limit for these values is `2147483647` (the Java Integer upper limit). It seems SourceTree needs be restarted for the changes to take effect. Also, in my case, I found the stash diff was still limiting to 100 lines in SourceTree 3.0.15. – Steve Chambers May 26 '20 at 10:21
  • The 100 line limit for new files in a stash is still unfixed in Sourcetree 3.3.9. Also see https://community.atlassian.com/t5/Sourcetree-questions/View-whole-stash-in-SourceTree/qaq-p/166728 – Steve Chambers Jun 03 '20 at 09:27
2

For some reason I don't see the "Max File Count" field on SourceTree 4.0.1 (234) on macOS.

One ugly trick to see the whole stash is:

  1. Copy your project folder and open the folder with SourceTree.
  2. Discard all active changes.
  3. Apply your stash.
  4. Copy or check any code you might need.
Sylven
  • 31
  • 4
-3

This question have been asked here more than once.

git stash show -p stash@{0}

is the command you are looking for.

Or if you want to add a small script you can do these following steps:

git config --edit --global

under the [alias] section write:

whatsInStash = "!f() { git stash show -p stash@{$1}; }; f"

And to call it:

git whatsInStash 1
Community
  • 1
  • 1
Edvin
  • 1,841
  • 4
  • 16
  • 23
  • 11
    Thanks for answering. But in my case the question is primarily about `SourceTree`. I like using a GUI instead of fiddling with the command line, so I'd really like it if I could get the `SourceTree` GUI to show the whole content of the stash... It might not be possible, but for now I'm going to hold off on accepting the answer... – user1429080 May 13 '16 at 15:47
  • In my case I wanted to output the whole stash to a file so I could then copy and paste lines various lines from *new* files in the stash. Just adding `> stash.txt` wasn't quite enough as the output had `+` symbols next to each line. Found a way around this by using the following command: `git stash show -p stash@{0} --color-words --color=never > stash.txt`. – Steve Chambers Jun 03 '20 at 09:38