GitHub垃圾收集提交请求中引用的悬挂提交吗? [英] Does GitHub garbage collect dangling commits referenced in pull requests?

查看:69
本文介绍了GitHub垃圾收集提交请求中引用的悬挂提交吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



The following situation arises from time to time…


I git checkout -b实验,提交一些实验性更改,并打开一个请求。

I git checkout -b experiment, commit some experimental changes, and open a pull request. After some discussion, the pull request is rejected.

如果我现在要删除远程分支,这是否会导致diff无法访问有些观点,或者GitHub确保在pull请求中出现的提交不被垃圾收集,即使它们没有出现在任何分支上?

If I were now to delete the remote branch, would this render the diff inaccessible at some point, or does GitHub ensure that commits which appear in pull requests are not garbage collected even if they don't appear on any branch?

我想删除死亡分支,但只有这样做不会降低拒绝的pull请求的历史价值。

I would like to delete dead branches, but only if doing so will not diminish the historical value of rejected pull requests.

推荐答案

不,它们不会是gc的因为即使删除分支,它们也不完全没有引用。

No, they will not be gc's because they're not wholly unreferenced even if you delete your branch.

Github为每个请求创建一个分支(实际上是两个)。它们处于非默认名称空间中,因此当您从回购中拉出(或取出)时,通常不会获取它们。

Github creates a branch (actually, two) for every pull request. They're in a non-default namespace so you dont usually get them when you pull (or fetch) from the repo.

要了解实际情况,请执行 git ls-remote< REMOTE> ,其中< REMOTE> 是远程名称(if这是你的回购知道的)或URL(它不需要是 git remote add ed for this to work)。这个远程应该有一些拉请求,否则你将无法看到我的意思。

To see how this looks in practice, do a git ls-remote <REMOTE>, where <REMOTE> is either the name of a remote (if it's one your repo knows) or the URL (it doesn't need to be git remote added for this to work). This remote should have some pull requests, or you won't be able to see what I mean.

这将列出远程(所有分支和标签)上的所有参考, ,你会看到一些像 refs / pull /< number> / head refs / pull /< number> / merge 。这些分别指PR中的最新提交和它合并的提交。

This will list all refs on the remote (all branches and tags), and you will see some refs like refs/pull/<number>/head and refs/pull/<number>/merge. Those refer to the latest commit in the PR and the commit at which it was merged in, respectively.

这篇关于GitHub垃圾收集提交请求中引用的悬挂提交吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆