Use git diff.
git diff [<options>] <commit>..<commit> [--] [<path>…]
<commit> is a branch name, a commit hash, or a shorthand symbolic reference.
Examples:
git diff abc123..def567
git diff HEAD..origin/master
That will produce the diff between the tips of the two branches. If you'd prefer to find the changes that occurred in the common ancestor since the branch was started off, you can use three dots instead of two:
git diff <commit>...<commit>
To check which files differ, not how the content differs, use --name-only:
git diff --name-only <commit>..<commit>
Note that in the <commit>..<commit> (two dot) syntax, the dots are optional; the following is synonymous:
git diff commit1 commit2
Answer from Lazy Badger on Stack OverflowUse git diff.
git diff [<options>] <commit>..<commit> [--] [<path>…]
<commit> is a branch name, a commit hash, or a shorthand symbolic reference.
Examples:
git diff abc123..def567
git diff HEAD..origin/master
That will produce the diff between the tips of the two branches. If you'd prefer to find the changes that occurred in the common ancestor since the branch was started off, you can use three dots instead of two:
git diff <commit>...<commit>
To check which files differ, not how the content differs, use --name-only:
git diff --name-only <commit>..<commit>
Note that in the <commit>..<commit> (two dot) syntax, the dots are optional; the following is synonymous:
git diff commit1 commit2
Go to a branch (e.g. main), then run diff against another branch (e.g. branch2):
git checkout main
git diff branch2
Videos
I'm working on a project with lots of branches with ridiculously long names. I need a workflow to quickly diff between them. I tried lazygit but that doesn't work https://github.com/jesseduffield/lazygit/discussions/4422
tig can't seem to do it either.
I guess I need roll something with fzf, or does anyone have suggestions for a lightweight UI?
How do I view file differences (not commits) between two branches in git? Latest commit of course.
If I compare the branches I get different results depending on which order I choose them. Files that are different only show up on direction or the other. I want to view the raw file differences so I don't miss anything.
Edit: my colleague took care of it. I'm not sure what I was doing wrong.
I am upgrading an asp.net mvc (.net framework) application to .net5. When I started I created a new branch in the git repository for the migration. Unfortunately, as much as I resisted, there were a few changes that I needed to make the the .net framework version after this point.
Is there a way to list the changes made to the master branch after the .net5 branch was created, to show me what I need to add the the .net5 branch to bring it to feature parity with the .net framework version?
I am solely using the git client inside Visual Studio 2022, but I am happy to hear cli or other gui solutions if it would make the job easier. The git repository is hosted on Azure DevOps if that makes a difference.
Cheers!