DiffMerge安装配置使⽤
概述:
在⽤git进⾏源代码版本维护的时候,常常会进⾏各代码版本之前区别的查看,例如在每次提交改动前进⾏git diff 可以看到源⽂件代码相对相应版本或是远程仓库的改动情况,如果有冲突还需要进⾏merge即整合改动的代码到指定版本(例如远程分⽀)
安装:
,安装完成在C:\Program Files\SourceGear\Common\DiffMerge⾥⾯有相关的⽂档介绍。
Git配置:
到git的 .gitconfig ⽂件,打开在⾥⾯添加下⾯这段。(sgdm的地址填你们⾃⼰的,但⼀般DiffMerge按默认是C:\Program Files\SourceGear\Common\DiffMerge) [diff]
tool = diffmerge
[difftool "diffmerge"]
cmd = C:/Program\\ Files/SourceGear/Common/ \"$LOCAL\" \"$REMOTE\"
[merge]
tool = diffmerge
[mergetool "diffmerge"]
trustExitCode = true
cmd = 'C:/Program Files/SourceGear/Common/' -merge -result=\"$MERGED\" \"$LOCAL\" \"$BASE\" \"$REMOTE\"
添加之后实际的
常⽤的命令:
1、git difftool [fileName]
2、git mergetool [fileName]
merge某个分⽀的时候存在冲突
$ git merge feature1
CONFLICT (content): Merge conflict
Automatic merge failed; fix conflicts and then commit the result.
Git告诉我们,⽂件存在冲突,必须⼿动解决冲突后再提交。git status也可以告诉我们冲突的⽂件:
$ git status
# On branch master# Your branch is ahead of 'origin/master' by 2 commits.## Unmerged paths:# (use "git add/rm <file>..." as appropriate to mark resolution)##
both modified: #
no changes added to commit (use "git add" and/or "git commit -a")
我们可以直接查看的内容:
Git is a distributed version control system.
Git is free software distributed under the GPL.
git常用指令Git has a mutable index called stage.
Git tracks changes of files.
<<<<<<< HEAD
Creating a new branch is quick & simple.
=======
Creating a new branch is quick AND simple.
>>>>>>> feature1
Git⽤<<<<<<<,=======,>>>>>>>标记出不同分⽀的内容,我们需要⼿动修改后保存常见问题:
编码:Tools--->options设置某类⽂件编码
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论