合并.gitignore中的冲突

Nyx*_*nyx 19 git github

我有2个分支,masternewfeature.当我要合并newfeaturemaster,我用:

git checkout master
git merge newfeature
Run Code Online (Sandbox Code Playgroud)

我收到错误:

Auto-merging .gitignore
CONFLICT (content): Merge conflict in .gitignore
Automatic merge failed; fix conflicts and then commit the result.
Run Code Online (Sandbox Code Playgroud)

我打开了.gitignore,现在看起来像一团糟,文件的最后一部分看起来像

<<<<<<< HEAD
public/img/ignore
=======
public/img/profiles
public/blog
public/recommendation
>>>>>>> newfeature
Run Code Online (Sandbox Code Playgroud)

发生了什么,以及如何修复以便我可以将分支合并到master

D-R*_*ock 21

您在两个分支中编辑了.gitignore.现在,git不确定每个副本中哪些行是正确的,所以它要求你解决它们.

线条:

<<<<<<< HEAD
public/img/ignore
=======
Run Code Online (Sandbox Code Playgroud)

是什么出现在master中的文件副本中.

=======
public/img/profiles
public/blog
public/recommendation
>>>>>>> newfeature
Run Code Online (Sandbox Code Playgroud)

在分支新特征

你应该只需要编辑文件,就像你希望它最终出现一样.然后...

git add .gitignore
git commit
Run Code Online (Sandbox Code Playgroud)


Łuk*_*ski 7

只需编辑.gitignore文件即可解决冲突:

之前

<<<<<<< HEAD
public/img/ignore
=======
public/img/profiles
public/blog
public/recommendation
>>>>>>> newfeature
Run Code Online (Sandbox Code Playgroud)

public/img/ignore
public/img/profiles
public/blog
public/recommendation
Run Code Online (Sandbox Code Playgroud)

然后:

git add .gitignore

git commit

自动生成的提交消息应该是apear,接受它(保存并关闭)并完成.