Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Diff branches in Atlassian Stash

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?

like image 642
user3311522 Avatar asked Feb 14 '14 22:02

user3311522


People also ask

Does each branch have its own stash git?

So there's only one "branch" containing all stashes. The machinery might become more clear in this answer: Is it possible to push a git stash to a remote repository? you can 'deduce' what branch the stash fits onto by doing, e.g. (asking: what branches contain the parent revision for this stash?)

How do I compare two branches in Sourcetree?

Another way to do this is to right-click on a branch and select the "Diff against current" context menu command (current refers to the branch you are currently working on). This will give you the diff between the head commits of the two branches.

What is branch type in bitbucket?

Branch types In Bitbucket, the prefix can be changed for all branches other than development or production. Development branch. Usually the integration branch for feature work and is often the default branch or a named branch. For pull request workflows, the branch where new feature branches are targeted. main.


2 Answers

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

like image 189
Rog Avatar answered Sep 28 '22 09:09

Rog


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}
like image 23
user376507 Avatar answered Sep 28 '22 11:09

user376507