Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any gui for git merge (w squash)? [closed]

My work flow:

  • branch from master
  • work in my branch, commit frequently (100+)
  • when the job is done in my branch, merge master into my branch, resolve all the conflict.
  • CODE REVIEW TIME before merging back to master

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?

like image 737
Tom Fishman Avatar asked Oct 08 '11 04:10

Tom Fishman


2 Answers

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".

like image 124
VonC Avatar answered Nov 15 '22 13:11

VonC


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...
like image 24
Jonathan Hartley Avatar answered Nov 15 '22 14:11

Jonathan Hartley