2012-06-10 76 views
1

什麼是命令git checkout removedFile的水銀相當於? removeFile這個詞表示通過基本shell rm -command而不是git rm -command進行刪除。git checkout已刪除文件在Mercurial中?

+0

哦!你只是問「我如何取回我刪除的文件,但沒有從版本控制中刪除」?這會更清楚。 –

回答

2
hg revert removedFile 

應該把你丟失的文件放回去。

0

git checkout removedFile對您有何幫助?對我來說,給一個不錯的,有意義的錯誤:

[email protected]:~$ git init test 
Initialized empty Git repository in /home/ry4an/test/.git/ 
[email protected]:~$ cd test/ 
[email protected]:~/test$ echo this > file 
[email protected]:~/test$ git add file 
[email protected]:~/test$ git commit 
[master (root-commit) 1b017c5] file added 
1 file changed, 1 insertion(+) 
create mode 100644 file 
[email protected]:~/test$ git rm file 
rm 'file' 
[email protected]:~/test$ git commit 
[master ec695d4] dsdfsdf 
1 file changed, 1 deletion(-) 
delete mode 100644 file 
[email protected]:~/test$ git checkout file 
error: pathspec 'file' did not match any file(s) known to git. 

如果你問你如何看待的刪除文件的內容hg cat是一個很好的命令來做到這一點,你可以找到使用hg log removedFile修訂ID 。

+0

...我並不是指''git rm something'',而是'removed $ remove'''''rm something'',即從fs中刪除的跟蹤文件仍然在git-tracking中,我想將其恢復。 – hhh

+0

聽起來像你只是意味着「我如何取消刪除我剛剛刪除的文件」。這很容易,並且@splattered位有你的答案。 –