[英]GIT, not able to stage for commit
在我的工作目錄中,我刪除了一個圖像。 問題是,我無法將其暫存以進行提交(添加或刪除)。
$ git status
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: ...
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
deleted: "public/images/logo-pb\357\200\242old.png"
每當我嘗試這些命令(甚至帶引號)時:
git add public/images/logo-pb\357\200\242old.png
git rm public/images/logo-pb\357\200\242old.png
它總是告訴我:
fatal: pathspec 'public/images/logo-pb357200242old.png' did not match any files
我不確定,但是問題可能出在轉義'\\'字符上。 你應該嘗試命令
git add public/images/logo-pb\\357\\200\\242old.png
git rm $(git ls-files --deleted)
將幫助您
git ls-files --deleted
給出從存儲庫中刪除文件的路徑,而git rm
將刪除它們。
您使用什么版本的git? 在我的版本( 1.9.4.msysgit.0
)中,我得到了刪除的assembly.xml
:
C:\projects\Project\src\main\assembly>git add assembly.xml
warning: You ran 'git add' with neither '-A (--all)' or '--ignore-removal',
whose behaviour will change in Git 2.0 with respect to paths you removed.
Paths like 'src/main/assembly/assembly.xml' that are
removed from your working tree are ignored with this version of Git.
* 'git add --ignore-removal <pathspec>', which is the current default,
ignores paths you removed from your working tree.
* 'git add --all <pathspec>' will let you also record the removals.
Run 'git status' to check the paths you removed from your working tree.
當我跑步時
git add -A assembly.xml
它不再抱怨了。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.