My work flow:
For CODE REVIEW, I need to show the differences between two heads and squash/organize my commits ( in about 5 commits ). What's the best GUI (cross-platform?) for this task?
The Sourcetree free Git GUI for Windows and Mac supports this.
Alternatively, to do it without a GUI, you can run
git rebase --interactive --autosquash
because you committed with commit message beginning with !squash (when those intermediate commits were about the same task)
See "Trimming GIT Checkins/Squashing GIT History".
The output of any 'git diff' command can be displayed in a GUI tool using the 'git difftool' command.
Firstly, the 'diff' command we want: Display the accumulated diffs introduced by every commit on 'mybranch' since it diverged from 'master' using:
git diff master...mybranch
or
git diff master...HEAD
Note this excludes any commits that have happened on master in the meantime, which is probably what you want if you are reviewing mybranch.
If mybranch is your current head, then this can be abbreviated:
git diff master...
Git will feed the output from diff commands into one of a list of about eight known GUI tools, using 'git difftool'. I use kdiff3 on OSX, and in the past I've used it happily on Linux too. I prefer kdiff3 because it lets me do 3-way merges when required, and it lets me edit the output of the merge manually as well as just selecting hunks to use.
First install kdiff3, then add a symlink to it on your PATH. For me, that was:
ln -s /Applications/kdiff3.app/Contents/MacOS/kdiff3 /usr/local/bin/kdiff3
Then tell git that you want to use kdiff3 as your GUI diff tool:
git config --global merge.tool kdiff3
Then view your diffs in it:
git difftool master...
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