6

I am trying to get a diff between two branches in stash. Specially before sending the pull request, wanted to verify the changes.

have been reading many articles trying to figure out a solution but haven't succeeded yet.

here are the articles I have looked into:

Git diff against a stash Compare and Diff for Branches

Does anyone have a solution?

Community
  • 1
  • 1
user3311522
  • 1,638
  • 3
  • 19
  • 33

2 Answers2

9

Currently, the only way to compare branches in Atlassian Stash is to create a pull request first. Otherwise, you can use local git commands to compare arbitrary commits or branches.

This is something we plan to improve in a future release. You can watch for updates here.

Edit: Since Stash 3.0 it is possible to compare branches directly in Stash

Rog
  • 4,075
  • 2
  • 24
  • 35
  • 6
    ...and here's a link to instructions on how to do it: https://confluence.atlassian.com/display/STASH/Stash+3.0+release+notes#Stash3.0releasenotes-Branchcomparisons – Steve Chambers Nov 20 '14 at 10:58
1

Do a git stash list to get the list of stashes. Then pick the ones you need to diff and use git diff on those two stashed changes

For example

~/> git stash list
stash@{0}: On XXX: temp1
stash@{1}: On XXX: temp
~/> git diff stash@{0} stash@{1}
user376507
  • 2,004
  • 1
  • 19
  • 31
  • 1
    Yes, I was trying to find a way that I can see the diff on stash web interface but could not. Seems like your solution is the only one. – user3311522 Feb 14 '14 at 23:37
  • Why was the answer down voted and the actual subject line changed? – user376507 Feb 16 '14 at 13:12
  • Someone probably didn't realize that the question was a bit ambiguous in the first revision. This is a perfectly valid answer to the way the _original_ question was interpreted. – Tim Post Feb 19 '14 at 08:23