Github for Windows ignoring .gitignore file [duplicate]

£可爱£侵袭症+ 提交于 2019-12-10 12:23:54

问题


I'm trying to get my .gitignore to ignore everything except my src files in my NetBeans project. My gitignore looks like this

nbproject/private/
build/
nbbuild/
dist/
nbdist/
nbactions.xml
nb-configuration.xml

and its placed directly in the root directory of the netbeans project. Whenever i build/run in NetBeans, it always says theres uncommitted changes in Netbeans Project/build/built-jar.properties and Netbeans Project/dist/CodeEditor.jar, both of which should be ignored. (along with other .class files if i modify the source code). How do i get Github for Windows to ignore these files?

the git repo is located here https://github.com/Arhowk/fJass


回答1:


It looks like you probably added that file to the index at some point prior to adding it to the .gitignore file.

It's fairly easy to get yourself into this tight spot where git won't track the delete of the file (because it's already in the .gitignore!) - so the easiest way to achieve what you need is to:

  • Remove the specific file from the .gitignore file
  • Delete the file
  • Commit this deletion action
  • Add the line back into the .gitignore
  • Re-add your ignored file.

OR

git rm --cached filename and commit the change using git commit -m "msg" and you will be done.



来源:https://stackoverflow.com/questions/24897273/github-for-windows-ignoring-gitignore-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!