简体   繁体   English

从Phabricator修订版恢复已删除的git分支

[英]Restore deleted git branch from Phabricator revision

I have an opened phabricator revision and I have accidentally deleted the underlying git branch. 我有一个打开的phabricator修订版,我不小心删除了底层的git分支。 I can retrieve the diffs from the revision and re-create the branch. 我可以从修订版中检索差异并重新创建分支。

But, Is there a way howto restore the deleted branch from the revision? 但是,有没有办法如何从修订版中恢复已删除的分支?

You can use arc patch to create a branch. 您可以使用arc patch来创建分支。 It will create a branch called arcpatch-D### where D### is your Diff ID. 它将创建一个名为arcpatch-D###的分支,其中D ###是您的Diff ID。 Once you have that branch, you can use git commands to create a new branch based from the head of that branch and name it however you like. 拥有该分支后,您可以使用git命令根据该分支的头部创建一个新分支,并根据需要为其命名。

Recommended steps: 1. arc patch D### 2. git checkout -b new-branch-name 建议步骤: arc patch D### 2. git checkout -b new-branch-name

From there you can do anything else you like. 从那里你可以做任何你喜欢的事情。

If you have access to the underlying git repo, you can simply use git reflog : you will see the commit referenced by the deleted branch. 如果您可以访问底层的git repo,只需使用git reflog :您将看到已删除分支引用的提交。

See for example " How do I get the deleted-branch back in git? ". 请参阅“ 如何在git中获取已删除的分支? ”。

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

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