She*_*797 8 git netbeans gitignore
当我做git状态时,netbeans private.xml会出现问题,我尝试在git中添加几个方法.但是gitignore根本不会忽视它.
git status
On branch master
Your branch is up-to-date with 'origin/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: .gitignore
modified: nbproject/private/private.xml
...
Run Code Online (Sandbox Code Playgroud)
我的git忽略文件是
node_modules/
dist/
*.log
nbproject/private/*
*.bak
*.orig
*~
*.log
*private.xml
Run Code Online (Sandbox Code Playgroud)
在同一个文件中尝试了nbproject/private/*和*private.xml.
Von*_*onC 18
已经跟踪的文件不会被忽略:您需要先从索引中删除.
git rm --cached private.xml
git add -u .
git commit -m "Record deletion of private.xml from the index"
Run Code Online (Sandbox Code Playgroud)
(该--cached选项确保文件保留在磁盘上)
然后你可以在.gitignore中添加它(不需要'*')
private.xml
Run Code Online (Sandbox Code Playgroud)
注意:无论何时忽略文件,您都可以查看.gitignore适用的规则:
git check-ignore -v -- private.xml
Run Code Online (Sandbox Code Playgroud)