问题
My .gitignore
file looks like that:
> cat .gitignore
.bundle
db/*.sqlite3
log/*.log
tmp/**/*
*~
But, git doesn't ignore the files ended with ~
:
> git status
# On branch master
# 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: app/views/jobs/_form.html.erb
# modified: app/views/jobs/_form.html.erb~
# modified: public/stylesheets/jobs_new_edit.css~
What could be th ereason for that?
回答1:
modified
means you have the file committed in the repo already. You should remove it first, then it will be ignored for addition.
回答2:
Probably because you have it versioned, it was added to the repository (or index) before.
来源:https://stackoverflow.com/questions/8678325/how-to-ignore-files-ended-with-in-git