svn 出现冲突时可以使用 meld . 命令合并。 而git的冲突合并详见内容
2016-08-04 09:22
796 查看
1、可以在任意目录使用
2、可以使用如下配置去设置merge tool 和 diff tool:
git difftool 和 git mergetool 命令的说明:
-g--[no-]gui
When git-difftool is invoked with the
简单的说就是有-g选项则使用
--[no-]trust-exit-code
git-difftool invokes a diff tool individually on each file. Errors reported by the diff tool are ignored by default. Use
git-difftool will forward the exit code of the invoked tool when
也就是说git-difftool对每个文件分别调用一个 diff tool,每个diff tool的运行错误默认都是被忽略的。 使用
如果使用了
3、当冲突发生时,你可以简单的使用
a、你修改了某些文件,且没有提交到本地库,这时你向pull服务器的版本,你大概是这样做的:
b、上面的错误提示你有一个文件未能更新,因为它未提交新的更改,因此不能merge。因此你一般会这样做来试图解决这个冲突:
c、当你提交更改之后再pull,则git会自动对更改的文件进行merge,但上面提示merge发生冲突,接下来你应该这样来查看有哪些地方发生了冲突:
但是这一步还有例外,也许你并不想合并冲突,因为你有足够的信心直接采用文件的某个版本,这时你可以这样:
d、最后结束merge:
冲突合并到此结束。
对于svn的合并,若出现错误,则其目录里将会有一些merge文件,这时候你可以直接再冲突的目录使用如下命令来合并冲突:
git mergetool --tool-help查看 git 所支持的merge tools。
2、可以使用如下配置去设置merge tool 和 diff tool:
git config --global --add merge.tool kdiff3 git config --global --add mergetool.kdiff3.path "C:/Program Files/KDiff3/kdiff3.exe" git config --global --add mergetool.kdiff3.trustExitCode false git config --global --add diff.guitool kdiff3 git config --global --add difftool.kdiff3.path "C:/Program Files/KDiff3/kdiff3.exe" git config --global --add difftool.kdiff3.trustExitCode false # git config --global --add diff.tool kdiff3 #一般不将默认的diff tool设为gui的tool
git difftool 和 git mergetool 命令的说明:
-g--[no-]gui
When git-difftool is invoked with the
-gor
--guioption the default diff tool will be read from the configured
diff.guitoolvariable instead of
diff.tool. The
--no-guioption can be used to override this setting.
简单的说就是有-g选项则使用
diff.guitool 设置的tool来作为diff tool。这个参数只对 git difftool 命令有效。
--[no-]trust-exit-code
git-difftool invokes a diff tool individually on each file. Errors reported by the diff tool are ignored by default. Use
--trust-exit-codeto make git-difftool exit when an invoked diff tool returns a non-zero exit code.
git-difftool will forward the exit code of the invoked tool when
--trust-exit-codeis used.
也就是说git-difftool对每个文件分别调用一个 diff tool,每个diff tool的运行错误默认都是被忽略的。 使用
--trust-exit-code可以在某个 diff tool 运行后返回非0时使 git-difftool 退出。
如果使用了
--trust-exit-code,则git-difftool会将返回码往下传递。
3、当冲突发生时,你可以简单的使用
git mergetool来解决冲突。具体演示如下:
a、你修改了某些文件,且没有提交到本地库,这时你向pull服务器的版本,你大概是这样做的:
$ git fetch origin $ git pull origin master From ssh://gitosis@example.com:22/projectname * branch master -> FETCH_HEAD Updating a030c3a..ee25213 error: Entry 'filename.c' not uptodate. Cannot merge.
b、上面的错误提示你有一个文件未能更新,因为它未提交新的更改,因此不能merge。因此你一般会这样做来试图解决这个冲突:
$ git add filename.c $ git commit -m "made some wild and crazy changes" $ git pull origin master From ssh://gitosis@example.com:22/projectname * branch master -> FETCH_HEAD Auto-merging filename.c CONFLICT (content): Merge conflict in filename.c Automatic merge failed; fix conflicts and then commit the result.
c、当你提交更改之后再pull,则git会自动对更改的文件进行merge,但上面提示merge发生冲突,接下来你应该这样来查看有哪些地方发生了冲突:
$ git mergetool
但是这一步还有例外,也许你并不想合并冲突,因为你有足够的信心直接采用文件的某个版本,这时你可以这样:
$ git checkout --ours filename.c $ git checkout --theirs filename.c $ git add filename.c $ git commit -m "using theirs"
d、最后结束merge:
$ git pull origin master $ git push master From ssh://gitosis@example.com:22/projectname * branch master -> FETCH_HEAD Already up-to-date.
冲突合并到此结束。
对于svn的合并,若出现错误,则其目录里将会有一些merge文件,这时候你可以直接再冲突的目录使用如下命令来合并冲突:
$ meld .
相关文章推荐
- 1git命令的使用,查看git仓库状态,添加文件到git跟踪,git提交,查看git分支,查看git仓库日志信息,切换git分支,解决git分支合并后出现冲突的问题
- git 常用命令(3)- git内容合并和冲突查看
- 1git命令的使用,查看git仓库状态,添加文件到git跟踪,git提交,查看git分支,查看git仓库日志信息,切换git分支,解决git分支合并后出现冲突的问题
- 解决mac OSX下安装git出现的"git命令需要使用开发者工具。您要现在安装该工具吗"
- iOS使用Xcode开发如何避免与解决冲突-不区分svn和git-100%保证你远离冲突
- 当出现no changes added to commit时如何正确使用git提交命令
- git迁移到svn时原有历史提交中出现过冲突导致git svn dcommit出错的解决办法
- SVN的使用,合并、冲突详解
- 如何使用git svn 命令下载svn仓库的代码
- GIT初学使用(二)- 实验分支的内容如何合并到主分支中
- git使用meld查看文件修改内容
- 执行SVN up和svn merge等命令出现在首位置的各字母含义以及SVN合并别人的修改
- 使用批处理BAT更新/合并SVN,并使用mvn命令打包
- android Studio Git命令--解决冲突和产看提交内容
- Git合并分支出现的冲突解决
- Git与SVN常用命令与管理工具的使用
- 在ASPX页面中使用include命令的发现,在DIV中显示另一页面的内容,这样可以使页面更加简洁
- Linux系统下使用mail发送一封简单的Internet邮件【以及验证邮件是否发送成功sendmail -bp,必须是root用户才可以使用此命令查看邮件消息队列中的内容】
- 使用man查看帮助时出现在命令括号中1~9代表的内容
- git中处理两个独立库独立分支合并出现的冲突