问题
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