.gitignored一些文件最近;尝试合并到以前的分支,忽略的文件显示为冲突

时间:2013-06-17 07:02:14

标签: git git-merge gitignore

我有一个分支devel,我在过去分支了A主题分支。

devel始终是A的父级(devel已经/不应该反映在A中)。很长一段时间后,我添加了一些文件到.gitignoreupdated the index of devel to reflect it.

现在我正在尝试将devel再次合并到A ..以反映这些更改(.gitignore ed文件来自它)但是它给了我一个忽略的合并冲突文件。我不希望A中的那些被忽略的文件。我怎么告诉那个git?

屏幕截图,如果它有帮助... enter image description here

1 个答案:

答案 0 :(得分:1)

我希望在将devel合并到A之前,确保在devel中忽略所有A个被忽略的文件。

诀窍是从A 所有的索引中删除,更新.gitignore内容,然后添加所有内容!

git checkout A
# update the .gitignore file from devel in A
git checkout devel -- .gitignore

# remove/add everything
git rm --cached -r .
git add .
git commit -m "new commit with devel gitignore files out" 

# then
git merge devel