您可以在GitHub上恢复/恢复已删除的分支多长时间?

问题描述:

这不是如何在Github中恢复丢失的分支的问题,而是您需要通过以下用户案例故事恢复已删除的分支的时间:

This is not a question on how to restore lost branches in Github, but rather how long you have to restore a deleted branch through the following user case story:

在拉取请求(通常用作代码查看的地方)内,可以合并分支,然后将其删除,所有这些都在github GUI中.如果您选择删除它,则可以使用带有粗体和下划线的单词的选项来还原"分支.

Within a pull request (often used as a place for code review) the branch can be merged and then deleted, all in the github GUI. Should you choose to delete it, you are given the option with a bold and underlined word, to "restore" the branch.

我怀疑此选项有时间限制,并且github不会无限期保持此状态.

I suspect this option has a time limit and that github doesn't keep this available indefinitely.

github对您可以执行多长时间有时间限制吗?如果可以,那么该时间限制是什么?

我问了 GitHub支持,这是他们的回应(重点是我的) :

I asked GitHub Support, this was their response (emphasis mine):

我们为所有Pull Request使用单独的ref名称空间,我们将其用于各种用途,包括还原分支.由于我们会无限期保留[Pull Request]引用,因此 恢复分支没有时间限制 .

We use a separate ref namespace for all Pull Requests which we use for various things including restoring the branch. Since we keep those [Pull Request] refs indefinitely, there's no time limit on restoring a branch.

您可以使用以下命令在遥控器中查看这些特殊引用:

You can see these special references in your remote by using the following:

$ git ls-remote | grep pull
From git@github.com:<username>/<remote>.git
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa        refs/pull/1/head
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb        refs/pull/1/merge
cccccccccccccccccccccccccccccccccccccccc        refs/pull/2/head
dddddddddddddddddddddddddddddddddddddddd        refs/pull/2/merge

引用在refs/pull/<pull request number>/下命名. head参考点位于被拉请求的分支的顶端,即分支上的最后一次提交.我不确定merge参考是什么.

The references are namespaced under refs/pull/<pull request number>/. The head reference points at the tip of the branch that's being pull requested, i.e. the last commit on the branch. I'm not sure what the merge reference is though.