Use beyond compare as Git's alignment and merge tool under WindowsIntroduced
In fact, all kinds of git GUI clients have their own tool, but the beginning of learning git, with the Windows Git Bash, and then gradually familiar with the various commands, with the graphics client instead of accustomed to.
Here's how to configure beyond compare as Git's Difftool and Mergetool. When you need to compare or merge conflicts, you can use Difftool and mergetool to call beyond compare for comparison and merge conflicts.
Operation
At present, my computer is installed Beyond Compare 4, on the introduction of 4 settings, Beyond Compare 3 is similar.
In fact, beyond Compare official website has introduced
How to configure Git Difftool and mergetool, in fact, just a few lines of GIT commands.
#difftool configuring git config--global diff.tool bc4git config--global difftool.bc4.cmd "\" C:/Program files (x86)/beyond compare 4/bcomp.exe\ "\" $LOCAL \ "\" $REMOTE \ "" #mergeftool configure git config--global merge.tool bc4git config--global mergetool.bc4.c md "\" C:/Program files (x86)/beyond compare 4/bcomp.exe\ "\" $LOCAL \ "\" $REMOTE \ "\" $BASE \ "\" $MERGED \ "" Git config--globa L Mergetool.bc4.trustExitCode True
But I followed the above step configuration, using the Difftool command, found left and right both sides are blank files. Study for half a day did not study the why.
Then suddenly remembered the user directory under the. Gitconfig look at the configuration, only to find out why.
The information you see in opening the configuration file is almost like this:
[Diff]tool = Bc4[difftool]prompt = False[difftool "Bc4"]cmd = \ "C:/Program files (x86)/beyond compare 4/bcomp.exe\" .....
With Git bash, there is no "$LOCAL", "$REMOTE" shadow in the. gitconfig file, so when you use Difftool, both sides are blank, because there is no argument to go into it.
So instead of a command setup, just edit the. gitconfig file settings, there's no problem.
Add the following configuration and save the. gitconfig file
[Diff]tool = Bc4[difftool]prompt = False[difftool "Bc4"]cmd = "\" C:/Program files (x86)/beyond compare 4/bcomp.exe\ "\" $LO Cal\ "\" $REMOTE \ "" [Merge]tool = Bc[mergetool]prompt = False[mergetool "Bc4"]cmd = "\" C:/Program files (x86)/beyond Compar E 4/bcomp.exe\ "\" $LOCAL \ "\" $REMOTE \ "\" $BASE \ "\" $MERGED \ ""
Then execute the command on the git command line, OK:)
#比对当前文件相对于Head版本的改动git difftool <file_name> #当merge <branch_name> Prompt for conflicts, execute the following command to bring up the BC merge conflict git Mergetool
Use beyond compare as Git's alignment and merge tool under Windows