git - 删除带有标签的分支

标签 git

我有 2 个关于删除分支、标记和 git 的 gc 的问题。

假设我有一个项目,我正在维护 2 个不同版本的软件。可以说我在其中一个版本中创建了许多标签。现在可以说我知道不再需要这个版本的开发线,因为它不再受支持,但出于历史目的我仍然想保留它。所以我在这个分支的头部创建了一个标签,然后删除了这个分支。

现在第一个问题,假设 git 的 gc 不会删除这些提交是否安全,因为我仍然有引用/必须提交的标签是树吗?

现在假设 2 年后,我不再需要访问该代码,所以我删除了标签。

我的第二个问题,既然我不再有任何标签/分支引用/在他们的历史中有那些提交,git 的 gc 是否会完全删除这些提交(以它设置的任何时间间隔)?

最佳答案

Now the first question, is it safe to assume the git's gc will not delete these commits since I still have tags that reference/have to commit is it tree?

对——因为标签仍然引用那行提交,所以它们不会被丢弃。

My second question, now that the I no longer have any tags/branch that reference/have in their history those commits, will git's gc completely delete those commit (at whatever interval it is set to)?

是的,因为不再有任何对它们的引用,它们最终会被收集起来。

关于git - 删除带有标签的分支,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9134228/

相关文章:

git - Ctrl-t 在终端 "git push"期间显示什么信息?

git - 如何更改 Git 存储库的位置

git - 如何从 Visual Studio 2013 将现有解决方案添加到 GitHub

git diff --numstat 与 --name-status

git - Git LFS 处理小文件的能力如何?

git - 2.0 版本的 git add --update 语法中 :/(colon, 正斜杠是什么意思?

git - 无法推送到 git 存储库 - 权限被拒绝

git - 清理 fork 并从上游重新启动它

bash - 如何将变量注入(inject) git submodule foreach?

eclipse - 有没有办法检索 eclipse 执行的 git 命令?