2013-01-07 136 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