我试图在Mac上设置全局gitignore文件,但由于某种原因,它没有生效。当我在Linux操作系统上重复相同的步骤时,一切都会好起来。低于我所做的。有人能指出我错过了什么吗?
注意:我以前提交过.idea文件,所以这会与它相关吗?以防万一,我也尝试添加.idea和.idea/*。
步骤
MacBook-Pro:~ bc$ echo $HOME
/Users/bc
MacBook-Pro:~ bc$ git config --get core.excludesfile
/Users/bc/.gitignore_global
MacBook-Pro:~ bc$ cat .gitignore_global
*~
.DS_Store
.idea/
MacBook-Pro:~ bc$ git config --global core.excludesfile /Users/bc/.gitignore_global项目
MacBook-Pro:Project bc$ git branch
* develop
master
MacBook-Pro:Project bc$ git status
On branch develop
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: .idea/workspace.xml
no changes added to commit (use "git add" and/or "git commit -a")发布于 2015-04-28 20:22:08
Git的忽略(不管是本地的还是全局的)只涉及没有添加到索引中的文件。一旦文件成为存储库的一部分,不管当前的忽略列表如何,git都将继续跟踪对它的更改。您需要使用以下方法从索引中删除文件
git rm --cached .idea/workspace.xml或者,您可以告诉git继续跟踪文件,但忽略本地更改。
git update-index --assume-unchanged .idea/workspace.xmlhttps://stackoverflow.com/questions/29928669
复制相似问题