I just finished a fairly large branch that I've been working on for over 2 months. I just rebased master into it and had to resolve a handful of conflicts. Now that I have rebased my feature branch, how can I go through file by file to see the highlighted differences of that compare on the featured branch compared to the master branch to make sure the rebase was done correctly?
Most answers here suggest using git diff
, but the con of that approach is that it shows the diff right in the console, which is not always convenient.
Here are some alternatives which will open GUI instead.
Using Gitk
Usually, while git (especially on Windows, with git-scm) you get a GUI tool called GitK which can be used to show the changes. So, just type:
gitk --all
And GUI will be opened where you can see the commits and the changes done by each commit.
Using DiffTool
Use git difftool
instead, and show the diff in the preferred diff tool.
Just type difftool
instead of diff
in the console like this:
To see the changes between 2 branches:
# For all the files
git difftool branch1..branch2
# For a single file
git difftool branch1..branch2 "filepath"
To see the changes on the last commit
# For all the files
git difftool HEAD~1
# For a single file
git difftool HEAD~1 "filepath"
To see the changes since the commit with ID (all/single file):
# For all the files
git difftool commitId
# For a single file
git difftool commitId "filepath"
To see the changes between 2 commits:
# For all the files
git difftool commitId1..commitId2
# For a single file
git difftool commitId1..commitId2 "filepath"
Notes
difftool
will open your default diff tool which is usually set to VimDiff.git diff
instead of git difftool
by leaving the parameters the same.