This answer shows how to see the differences between a specific file foo.bar
in two different branches in git
. My question is how to do this within magit
?
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.
On the Github, go to the Source view of your project. You will see a link named 'Branch List'. Once the page opens you can see a list of all the remote branches. Hit on the Compare button in front of any of the available branches to see the difference between two branches.
You can run the git diff HEAD command to compare the both staged and unstaged changes with your last commit. You can also run the git diff <branch_name1> <branch_name2> command to compare the changes from the first branch with changes from the second branch.
I use magit to complement vc
. vc
already has this functionality C-u C-x v =
Just wanted to note that this is now directly possible with magit
.
In the Magit status buffer, type d
to open up the diff popup.
Then limit the diff to your file of interest with =f
and the file name.
Finally, do a diff range r
and type in the branch that you want to compare to (one can also type in a specific commit on the same branch, see a similar question).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With