这是什么文件,我在使用gitmerge工具解决冲突时得到了它们? [英] What are this files, I got them while using gitmerge tool for resolving the conflicts?
问题描述
gitmergetool
的工作方式.我在进行git merge时遇到冲突,现在我想摆脱那些合并冲突,因此我正在浏览SO以获取有关如何执行此操作的信息,并且有人建议使用git mergetool,但我从未使用过git merge tool,但是当我确实使用git merge工具时,要获取一些本地文件,远程文件和备份文件作为自己的文件,然后我会得到
How does gitmergetool
works. I have conflicts while doing git merge and now I want to get rid of those merge conflicts and I was browsing SO to get some information on how to do it and there was one suggestion of using git mergetool, I have never used git merge tool but when I do use git merge tool than am getting some local, remotes and backups files for my own files and than I have something like
#*merge*#30260IgX# #*merge*#48883jX#
这个文件是什么意思(如果可以这样说的话)是什么意思,以及如何删除它,因为我不确定它是什么...我不想将其提交给我的仓库,任何建议或解决这个问题,如果有人可以指出我使用git merge tool
的适当资源,也将不胜感激.
What does this file(if I may say so) means and how do I can get rid of it as I am not sure of what it is...I do not want to commit this to my repos, any suggestions or work around and also would appreciate if some one can point me to proper resource for using git merge tool
.
谢谢!!!
推荐答案
-
"与"git mergetool"合并"是一个起点,关于difftool和mergetool的一般理论在以下内容中提出:
"如何查看"git diff'与视觉差异程序的输出?""Merging with "git mergetool"" is a starting point, the general theory behing difftool and mergetool being presented in:
"How do I view ‘git diff’ output with visual diff program?"就是说,对于某些标准的差异/合并工具,它甚至更简单:
"一种更简单的设置方法Windows上针对Git的差异和合并工具"that being said, for certain standard diff/merge tool, it is even simpler:
"An easier way to set up diff and merge tools for Git on Windows"第一步,安装 KDiff3 .
它不是世界上最漂亮的GUI,但是一旦习惯了它,它就会非常有用,并且具有无需配置太多就可以与Git进行自然工作的额外优势.First step, install KDiff3.
It's not the prettiest GUI in the world, but once you get used to it it is quite usable and has the added advantage of working quite naturally with Git without having to configure much.第二步,打开您的
.gitconfig
(在主目录中,C:\Users\(username)
或旧的Documents and Settings
路径中),然后添加以下内容:Second step, open your
.gitconfig
(in your home directory,C:\Users\(username)
, or down ye oldeDocuments and Settings
path), and add the following:[diff] tool = kdiff3 [merge] tool = kdiff3 [mergetool "kdiff3"] path = C:/Program Files/KDiff3/kdiff3.exe keepBackup = false trustExitCode = false
现在,所有对
git difftool
和git mergetool
的调用都应默认为KDiff3.
这就是您要做的一切!
比烦扰所有这些包装器要简单得多.Now all calls to
git difftool
andgit mergetool
should default to KDiff3.
That's all you need to be good to go!
Much simpler than bothering with all those wrappers.
You will find a good tutorial here (in the excellent gitguru):
git mergetool
命令允许将那些工具集成到合并过程中.在确定合并冲突后运行,它将遍历需要解决的文件,并为指定的工具提供调用三向合并所必需的版本信息.The
git mergetool
command allows for the integration of those tools into the merge process. Run after merge conflicts have been identified, it loops through the files that need to be resolved and provides the specified tool with the version information necessary to invoke the 3-way merge.git mergetool
已经包括对许多开源和免费可用的合并工具的支持:kdiff3,tkdiff,meld,xxdiff,emerge,vimdiff,gvimdiff,ecmerge和opendiff.git mergetool
already includes support for a number open source and freely available merge tools: kdiff3, tkdiff, meld, xxdiff, emerge, vimdiff, gvimdiff, ecmerge, and opendiff.只要存在命令行调用,就可以通过自定义配置设置添加对其他工具(包括DiffMerge和Araxis Merge)的支持:
Support for additional tools including DiffMerge and Araxis Merge can be added via custom configuration settings provided a command-line call exists:
git config --global mergetool.[tool].cmd [command-line call] git config --global mergetool.[tool].trustExitCode [true|false]
使用"
--global
"标志,因此该设置将应用于所有Git存储库.The "
--global
" flag is used so the setting will apply across all of your Git repositories.命令行需要接受作为参数传入的以下文件变量:
The command line needs to accept the following file variables passed in as parameters:
-
$LOCAL
–当前分支版本 -
$REMOTE
–要合并的版本 -
$BASE
–共同祖先 -
$MERGED
–将要写入结果的文件 $LOCAL
– Current branch version$REMOTE
– Version to be merged$BASE
– Common ancestor$MERGED
– File where results will be written
git mergetool
会将版本创建为临时文件,并在执行工具命令行之前适当地设置变量.git mergetool
will create the versions as temporary files and set the variables appropriately before the tool command-line is executed.如果工具在成功合并或失败之后返回正确的退出代码,则可以将
trustExitCode
设置设置为true.否则将其设置为false,这样将提示您是否解决了文件的合并冲突.If the tool returns a proper exit code after a successful or unsuccessful merge, then the
trustExitCode
setting can be set to true. Otherwise set it as false so you will be prompted as to whether the merge conflicts for a file were resolved.执行合并冲突
使用mergetool进行合并的命令顺序为
The sequence of commands for a merge using mergetool would be
git merge git mergetool -t [tool] git add . git commit
您可以通过merge.tool设置指定默认工具
You can specify a default tool via the merge.tool setting
git config --global merge.tool [tool]
这将使您只需致电即可
This will allow you to just simply call
git mergetool
替代文字http://gitguru.com/wp-content /uploads/2009/02/opendiff.png
这篇关于这是什么文件,我在使用gitmerge工具解决冲突时得到了它们?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
-