我在项目中有一个文件,在之前的提交中存在,后来被另一次提交删除。我想用
以下是我的尝试(已经过处理)的追踪信息:
git clean
命令删除该文件,但它却无法删掉。我只好采用了直接使用rm
命令删除的方法,但我很好奇:git clean
为什么不能将这个文件视为可删除的文件呢?以下是我的尝试(已经过处理)的追踪信息:
me@mybox:/myproj/build$ git reset --hard origin/master
HEAD is now at 64a87ed Merge branch 'dev/phrogz/whee' into 'master'
me@mybox:/myproj/build$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
../app/faux/prep.sh
nothing added to commit but untracked files present (use "git add" to track)
me@mybox:/myproj/build$ git clean -n
me@mybox:/myproj/build$ git clean -f -d
me@mybox:/myproj/build$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
../app/faux/prep.sh
nothing added to commit but untracked files present (use "git add" to track)
me@mybox:/myproj/build$ rm ../app/faux/prep.sh
me@mybox:/myproj/build$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean
cd .. ; git clean -n
or perhapsgit clean -n ..
- Dietrich Epp