当我必须修复合并冲突时,我想请求git给我$ REMOTE,$ BASE和$ LOCAL文件(因为选项keepTemporaries
似乎不起作用,请参阅{{3} }线程)。有没有命令这样做?
谢谢!
答案 0 :(得分:2)
来自git help gitrevisions
:
:<n>:<path>, e.g. :0:README, :README
A colon, optionally followed by a stage number (0 to 3) and a colon, followed by a path, names a blob object in the
index at the given path. A missing stage number (and the colon that follows it) names a stage 0 entry. During a
merge, stage 1 is the common ancestor, stage 2 is the target branch_s version (typically the current branch), and
stage 3 is the version from the branch which is being merged.
因此,如果您位于git checkout mybranch; git merge otherbranch
的中间,并且conflict.txt
上存在冲突,则git show :2:conflict.txt
将显示mybranch
中文件的版本(您的&#34; $ LOCAL&#34;),git show :3:conflict.txt
将显示来自otherbranch的版本(您的&#34; $ REMOTE&#34;),git show :1:conflict.txt
将显示提交中的版本由git merge-base mybranch otherbranch
(您的&#34; $ BASE&#34;)确定。
对于没有冲突的文件,请使用git show :0:cleanfile.txt
或git show cleanfile.txt
。