Use beyond compare as Git's alignment and merge tool under Windows

Source: Internet
Author: User
Tags git commands git mergetool

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.