2013-01-07 134 views
3

在Perforce的,我怎麼回覆我已經發了文件的變化?如何在Perforce中恢復文件?

$ p4 status 
UI\FormMain.cs - reconcile to edit //UI/FormMain.cs#73 

$ p4 revert UI/FormMain.cs 
UI/FormMain.cs - file(s) not opened on this client. 

在Git中我做這個用命令git checkout

$ git status 
# On branch 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: Form.cs 
# 
no changes added to commit (use "git add" and/or "git commit -a") 

$ git checkout Form.cs 

$ git status 
# On branch master 
nothing to commit, working directory clean 
+0

通常Perforce的工作流程是爲編輯明確打開的文件*第一*通過'P4 edit'觸摸文件之前(否則服務器將不知道,當你試着去'P4 revert'不會做任何事情)。如果你遵循這種做法,事情會更順利。 – jamesdlin

回答

4

如果不打開文件,但是你在本地做了一些改動,使用

p4 sync -f UI/FormMain.cs 

告訴Perforce的強制(-f)同步你對FormMain.cs的副本你機器與服務器的版本。

+0

謝謝'P4同步檢出操作-f UI/FormMain.cs'工作。 –

0

相反的p4 revert UI/FormMain.cs你應該叫p4 revert //UI/FormMain.cs,因爲這是在庫符號的絕對路徑。 與出領先//相對於您的當前位置在客戶工作區文件,標誌着該文件。

+0

這是不行的,它給了我同樣的「文件(S)這個客戶端上沒有打開。」錯誤。 –

+0

「p4開」告訴你什麼? – pitseeker

+0

'P4恢復'僅適用於打開的文件進行編輯與'P4編輯'或通過P4V應用 – N0dGrand87