交互式合并使用git和未跟踪的本地文件跟踪的文件 [英] Interactively merge files tracked with git and untracked local files
问题描述
我使用几个软件包(如gitlab),你通过从他们的git repo克隆安装。它们通常带有一些 config.example
(在版本控制下),你复制到自己的 config
文件在版本控制下,甚至在 .gitignore
中忽略),并适应您的需求。
I use a couple of software packages (like gitlab) that you install by cloning from their git repo. They typically come with some config.example
(under version control), which you copy to your own config
file (not under version control or even ignored in .gitignore
) and adapt to your needs.
并且例如更改显然只会在 config.example
中反映的配置文件选项。
When the upstream package is updated and for example changes the config file options that will obviously only be reflected in config.example
.
git命令链,我缺少,可以帮助我比较 config.example
到 upstream / HEAD
甚至可以将它们交互地合并到我的本地 config
文件中?
Is there a chain of git commands that i'm missing that can help me compare the changes of config.example
to the new one in upstream/HEAD
and maybe even merge them interactively into my local config
file?
得到类似 git add / commit --interactive
中的交互式补丁模式。
Would be awesome if i could get something like the interactive patch mode in git add/commit --interactive
.
推荐答案
git checkout --patch
选择差异块,最简单的是将你的内容放在上游路径,然后清除:
git checkout --patch
selects diff hunks, simplest here might be to put your content at the upstream path, do that, and clean up after:
cp config config.example
git checkout -p upstream config.example
mv config.example config
git checkout @ config.example
这将获得从 git add --patch
。
这篇关于交互式合并使用git和未跟踪的本地文件跟踪的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!