您的位置:首页 > 其它

.gitignore失效的解决办法

2014-08-11 01:51 260 查看


.gitignore失效的解决办法

How to make .gitignore works?

Just got the answer from the IRC channel.

Running command:

git rm -r --cached .(delete all cached file)


This removes everything from the index, then just run:

git add .


Commit it:

git commit -m ".gitignore is now working"



To untrack a file that has already been added/initialized to your repository, ie stop tracking the file but not delete it from your system use:

git rm --cached filename (delete single cached file)



Yes - .gitignore system only ignores files not currently under version control from git. I.e. if you've already added a file called test.txt using git-add, then adding test.txt to .gitignore will still cause changes to test.txt to be tracked. You would have
to git-rm test.txt first, commit that change. Only then will changes to test.txt be ignored.



another problem I had was I placed an inline comment.
tmp/*   # ignore my tmp folder (this doesn't work)


this works
# ignore my tmp foldertmp/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: