简体   繁体   English

相当于Git在perforce中的“修改最后提交”

[英]Equivalent of Git's “amend last commit” in perforce

New to Perforce. Perforce新手。 After submitting my change list, I realized that I had missed one tiny thing that's not worth writing a submit message about. 在提交我的更改列表后,我意识到我错过了一件不值得写提交消息的小事。 Thus I submitted this change with the exact same message, thinking that it would be around the same thing as amending my last commit in Git. 因此,我用完全相同的消息提交了这个更改,认为它与修改我在Git中的最后一次提交大致相同。 Evidently it wasn't, as a new revision with this absurdly tiny change was created instead. 显然它不是,因为这个荒谬的微小变化的新版本被创建了。

Is there any way to merge the two commits (on the exact same file) now that I've already submitted them both? 现在我已经提交了两个提交,有没有办法合并两个提交(在完全相同的文件上)? How would I handle this situation next time? 我下次怎么处理这种情况?

If you have "admin" or higher permissions you can "take back" submitted changelists with the "p4 unsubmit" command: 如果您具有“admin”或更高权限,则可以使用“p4 unsubmit”命令“收回”提交的更改列表:

% p4 help unsubmit

unsubmit -- unsubmit a changelist, making it a shelf

p4 unsubmit [-n -r remote] file[revRange]...

    The unsubmit command takes one or more submitted changelists and
    undoes the submission, leaving the changelist as a shelved change
    with the same content. The changelist can then be unshelved and
    further updated prior to resubmitting it.

    ...

    The unsubmit command requires admin permission granted by
    p4 protect.

Once the changelists go from "submitted" to "pending" you can combine them, discard them, modify them, etc prior to submitting them again. 一旦变更列表从“提交”变为“待定”,您可以在再次提交之前将它们组合,丢弃,修改它们等。

If you're not an admin, all history is immutable once submitted. 如果您不是管理员,则所有历史记录在提交后都是不可变的。

Unless you are the Perforce admin your can't edit the files submitted, but you can edit the commit message. 除非您是Perforce管理员,否则您无法编辑提交的文件,但您可以编辑提交消息。

The Perforce admin could you p4 obliterate possibly to get rid of the intermediate file version, but I'm not sure what that would do to your commits. Perforce管理员可以p4删除可能摆脱中间文件版本,但我不确定这会对你的提交做什么。 It certainly wouldn't combine them. 它当然不会将它们结合起来。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM