Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git 合并工具的使用 mergetool #12

Open
jerryni opened this issue Apr 15, 2016 · 0 comments
Open

git 合并工具的使用 mergetool #12

jerryni opened this issue Apr 15, 2016 · 0 comments
Labels

Comments

@jerryni
Copy link
Owner

jerryni commented Apr 15, 2016

平台: MAC

目录

  • 配置方式
  • 使用方法

配置方式

下载kdiff3(我用过最好用的git合并对比工具):

官网下载: http://sourceforge.net/projects/kdiff3/files/

下载完成后, 修改gitconfig

打开git全局命令:

open ~/.gitconfig

修改/添加 以下配置

[merge]
    tool = kdiff3
[mergetool "kdiff3"]
    cmd = /Applications/kdiff3.app/Contents/MacOS/kdiff3 \"$BASE\" \"$LOCAL\" \"$REMOTE\" -o \"$MERGED\"
    trustExitCode = false
    path = /Applications/kdiff3.app/Contents/MacOS/kdiff3
[mergetool]
    keepBackup = false

[diff]
    tool = kdiff3
[difftool "kdiff3"]
    cmd = /Applications/kdiff3.app/Contents/MacOS/kdiff3 $LOCAL $REMOTE

实例使用

场景: 我们要在test2分支, 合并test1的分支

git merge test1

发现冲突文件 modules/index/module.js

使用工具进行合并:

git mergetool modules/index/module.js

untitled2.png

kdiff3 的界面说明图2:
untitled1.png

操作图3:
untitled3.png

合并思路:

  • 通过 fn+cmd+上下方向键, 在冲突间移动
  • 对比BASE, LOCAL, REMOTE文件内容,然后使用图3中的操作选择你要的内容; 或者直接修改OUTPUT的内容也可以~
  • 所有冲突都解决完后, 保存,退出即可;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant