Git configures diff and the merge tool---diffmerge in a Windows environment

Source: Internet
Author: User
Tags diff git mergetool

Reference Source: Http://coding4streetcred.com/blog/post/Configure-DiffMerge-for-Your-Git-DiffTool
Main transfer from: http://blog.csdn.net/u010232305/article/details/51767887

1. Download Diffmerge

http://sourcegear.com/diffmerge/downloads.php, the landlord chose Windows Installer (64bit), installation directly next, this version can only be installed on the C drive

2. Create a startup Diffmerge script(1) Create the following two scripts under the \cmd path of the git installation path

git-difftool-diffmerge-wrapper.sh content is

1# Place thisfile inchThe Windows Git installation directory/cmd folder2# Be sure to add the. /cmd folder to the PATH environment variable3 4#diffis called by Git with7Parameters:5# path old-fileOld-hex Old-mode new-fileNew-hex new-Mode6 7 "C:\Program Files\sourcegear\common\diffmerge\sgdm.exe" " $" " $"|Cat

git-mergetool-diffmerge-wrapper.sh content is

1# Place thisfile inchThe Windows Git installation directory/cmd folder2# Be sure to add the. /cmd folder to the PATH environment variable3 4 # passing the following parameters to Mergetool:5 # local base remote Merge_result6 7 "C:\Program Files\sourcegear\common\diffmerge\sgdm.exe"" $"" $"" $"--result="$4"--title1="Mine"--title2="Merge"--title3="Theirs"

Note: The path name is the actual pathname of the installed DiffMerge.exe, and the landlord is "C:/Program Files/sourcegear/common/diffmerge/sgdm.exe"

(2) Set the \CMD environment variable, easy to find

The Git program's cmd directory is added to the environment variable path, the landlord's "C:\Program Files\git\cmd"

3. Modify the Git configuration

Locate the. gitconfig file (path under Windows user path)


Upsert the following content:

1 [Merge]2Tool =Diffmerge3[diff]4Tool =Diffmerge5 [Mergetool]6Keepbackup =false7[Mergetool"Diffmerge"]8cmd = Git-mergetool-diffmerge-wrapper.SH "$LOCAL" "$BASE" "$REMOTE" "$MERGED"9[Difftool"Diffmerge"]Tencmd = Git-difftool-diffmerge-wrapper.SH "$LOCAL" "$REMOTE"
4. OK

When the merge conflict occurs, enter
git mergetool
Diffmerge's out.

Git configures diff and the merge tool---diffmerge in a Windows environment

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.