Lee*_*fin 46 git github git-svn
我有一个.classpath
目前在GIT存储库中的文件.
我从remove repository(git pull origin master
)中删除后.如何从GIT控件中删除此文件,我的意思是NOT to delete
来自我的计算机的此文件,但将其从GIT版本控制中删除.(因为版本控制不需要此文件).
PS
我试过git rm <path-to>/.classpath
,但是然后我的整个项目抱怨错误的类路径,为什么git rm删除我的文件而不是从版本控制中删除?
Pla*_*ure 97
用于git rm --cached
从索引中删除但不从工作树中删除.
之后,您应该添加.classpath
到.gitignore文件,以防止再次提交.
Use*_*ess 15
为什么git rm删除我的文件而不是从版本控制中删除???
因为这就是它所说的.
$ git help rm
NAME
git-rm - Remove files from the working tree and from the index
SYNOPSIS
git rm [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch] [--quiet]
[--] <file>...
DESCRIPTION
Remove files from the index, or from the working tree and the index.
... When --cached is given,
the staged content has to match either the tip of the branch or the
file on disk, allowing the file to be removed from just the index.
OPTIONS
...
--cached
Use this option to unstage and remove paths only from the index.
Working tree files, whether modified or not, will be left alone.
Run Code Online (Sandbox Code Playgroud)
正如Platinum Azure所说,git rm --cached
只使用它从源代码控制中删除它,并用.gitignore
它来阻止它并停止显示git status
.
归档时间: |
|
查看次数: |
47535 次 |
最近记录: |