尽管gitignore应该忽略它们,但文件仍存在冲突 [英] Files are in conflict despite gitignore should ignore them

查看:229
本文介绍了尽管gitignore应该忽略它们,但文件仍存在冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些文件有冲突,尽管.gitignore应该忽略它们.如果我尝试更新解决方案,则会显示Unmerged path.

I have some files in conflict, despite .gitignore should ignore them. If I try to update the solution I get Unmerged path.

git status带以下内容:

On branch master
Your branch is up-to-date with 'origin/master'.

Unmerged paths:
  (use "git reset HEAD <file>..." to unstage)
  (use "git add/rm <file>..." as appropriate to mark resolution)

    deleted by us:   abc_Library.userprefs
    deleted by us:   abc_Library/bin/Debug/abc_Library.dll
    deleted by us:   abc_Library/bin/Debug/abc_Library.dll.mdb
    deleted by us:   abc_Library/obj/Debug/abc_Library.dll

no changes added to commit (use "git add" and/or "git commit -a")

我已经定义了以下.gitignore

[Bb]in/
[Oo]bj/
*.userprefs
.DS_Store

我记得我已经修复了未跟踪的文件.可能是团队成员没有gitignore文件并再次添加了不需要的文件吗?还是应该再次修复未跟踪的文件?

As I can remember I already have fixed the untracked files. Can it be that a team member doesn't have the gitignore file and added the not needed files again? Or should I fix the untracked files again?

现在我用

git rm --cached abc_Library/obj/Debug/abc_Library.dll

并且文件不再显示为冲突.

and the files don't appear as conflict anymore.

推荐答案

:

gitignore文件指定Git应该忽略的故意未跟踪的文件.已被Git跟踪的文件不受影响.

A gitignore file specifies intentionally untracked files that Git should ignore. Files already tracked by Git are not affected.

.gitignore添加文件名,路径或模式时,应从存储库中删除受影响的文件:

When you add file names, paths or patterns to .gitignore you should remove the affected files from your repository:

git rm --cached abc_Library.userprefs

选项--cached要求git仅从索引中删除文件,以这种方式准备在下次提交时从存储库中删除文件.工作树中的文件(无论是否修改)都不会受到任何影响.

The option --cached asks git to remove the file only from the index, preparing this way the removal from repository on the next commit. The file from the working tree, modified or not, is not affected in any way.

这篇关于尽管gitignore应该忽略它们,但文件仍存在冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆