在git中忽略修改(但未提交)的文件? [英] Ignore modified (but not committed) files in git?
问题描述
我能告诉git忽略被修改(删除)但不应该被提交的文件吗?
这种情况是我在repo中有一个子目录,它包含我根本不感兴趣的东西,所以我删除了它,以防止它出现在自动完成等(在IDE中)。
但现在,如果我将该文件夹添加到.gitignore,则没有任何更改,所有的东西都显示为被git status删除。
有没有办法让git忽略它(或者,因为我使用的是git-svn,我可以将更改提交给本地git,并确保它们不会传递到svn repo?) .htmlrel =noreferrer> git-update-index手册页和--assume-unchanged位及相关信息。
问题我这样做
git update-index --assume-unchanged di r-im-removing /
或特定文件
git update-index --assume-unchanged config / database.yml
Can I tell git to ignore files that are modified (deleted) but should not be committed?
The situation is that I have a subdirectory in the repo which contains stuff I'm not interested in at all, so I deleted it to prevent it showing up in auto-completions and the like (in the IDE).
But now, if I add that folder to .gitignore, simply nothing changes, all the stuff is shown as deleted by git status.
Is there a way to make git ignore it either way?
(Alternatively, as I'm using git-svn, could I commit the changes to the local git and ensure they are not passed on to the svn repo?)
check out the git-update-index man page and the --assume-unchanged bit and related.
when I have your problem I do this
git update-index --assume-unchanged dir-im-removing/
or a specific file
git update-index --assume-unchanged config/database.yml
这篇关于在git中忽略修改(但未提交)的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!