当我键入gitdiff时,我想用我选择的可视化diff工具(Windows上的SourceGear“diffmerge”)查看输出。如何配置git以执行此操作?
当前回答
安装Meld:
# apt-get install meld
然后选择它作为difftool:
$ git config --global diff.tool meld
如果要在控制台中运行,请键入:
$ git difftool
如果要使用图形模式,请键入:
$ git mergetool
结果将是:
'git mergetool' will now attempt to use one of the following tools:
meld opendiff kdiff3 tkdiff xxdiff tortoisemerge gvimdiff diffuse
diffmerge ecmerge p4merge araxis bc3 codecompare emerge vimdiff
Merging:
www/css/style.css
www/js/controllers.js
Normal merge conflict for 'www/css/style.css':
{local}: modified file
{remote}: modified file
Hit return to start merge resolution tool (meld):
所以只需按Enter键即可使用meld(默认)。这将打开图形模式。进行神奇的保存并按下以解决合并。这就是全部。
其他回答
对以前的伟大答案的简短总结:
git difftool --tool-help
git config --global diff.tool <chosen tool>
git config --global --add difftool.prompt false
然后通过键入(也可以选择指定文件名)使用它:
git difftool
尝试此解决方案:
$ meld my_project_using_git
Meld了解Git,并提供最近更改的导航。
安装Meld:
# apt-get install meld
然后选择它作为difftool:
$ git config --global diff.tool meld
如果要在控制台中运行,请键入:
$ git difftool
如果要使用图形模式,请键入:
$ git mergetool
结果将是:
'git mergetool' will now attempt to use one of the following tools:
meld opendiff kdiff3 tkdiff xxdiff tortoisemerge gvimdiff diffuse
diffmerge ecmerge p4merge araxis bc3 codecompare emerge vimdiff
Merging:
www/css/style.css
www/js/controllers.js
Normal merge conflict for 'www/css/style.css':
{local}: modified file
{remote}: modified file
Hit return to start merge resolution tool (meld):
所以只需按Enter键即可使用meld(默认)。这将打开图形模式。进行神奇的保存并按下以解决合并。这就是全部。
使用新的gitdifftool,只需将其添加到.gitconfig文件中即可:
[diff]
tool = any-name
[difftool "any-name"]
cmd = "\"C:/path/to/my/ext/diff.exe\" \"$LOCAL\" \"$REMOTE\""
也可以选择添加:
[difftool]
prompt = false
还可以查看diffall,这是我编写的一个简单脚本,用于扩展串行打开每个文件的烦人(IMO)默认diff行为。
Windows上的全局.gitconfig位于%USERPROFILE%\.gitconfig中
你可以使用gitdifftool。
例如,如果您有Meld,可以通过以下方式编辑分支master和devel:
git config --global diff.external meld
git difftool master..devel
推荐文章
- 为什么我需要显式地推一个新分支?
- 如何撤消最后的git添加?
- Rubymine:如何让Git忽略Rubymine创建的.idea文件
- Gitignore二进制文件,没有扩展名
- Git隐藏错误:Git隐藏弹出并最终与合并冲突
- 了解Git和GitHub的基础知识
- 没有。Git目录的Git克隆
- Git与Mercurial仓库的互操作性
- 忽略git中修改(但未提交)的文件?
- “git restore”命令是什么?“git restore”和“git reset”之间有什么区别?
- Git合并与强制覆盖
- Git拉另一个分支
- 在Bash命令提示符上添加git分支
- 如何更改Git日志日期格式
- git pull -rebase和git pull -ff-only之间的区别