是否有一个特殊的名称(如HEAD,FETCH_HEAD)用于git仓库当前分支上的根提交? [英] Is there a special name (like HEAD, FETCH_HEAD) for the root commit on the current branch in a git repository?

查看:185
本文介绍了是否有一个特殊的名称(如HEAD,FETCH_HEAD)用于git仓库当前分支上的根提交?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现自己是指各种原因的根提交。我通常会创建一个名为 first root 的标签以简化操作,但我一直在处理不少存储库最近甚至这个手动标记变得非常乏味。

有没有简单的方法来引用根提交,类似于 HEAD FETCH_HEAD

解决方案

我只看到第一个与您相关的标记, 。
这样,您可以通过名称良好的标记来引用它,而不是通过日志查找其SHA1。注意:在一个Git仓库中可以有几个根提交(即没有任何父项的几个提交)

参见实例 this thread ,with JakubNarębski的回答:


更不用说,你可以在git仓库中拥有多个根(多个提交没有父项)。

除了独立分支(比如' man ', ' html '或' todo '),这通常是吸收或子树合并其他项目的结果。
在' master '分支中,有5个根或更多:加入' git-tools '( mailinfo / mailsplit ),吸收 gitweb 和子树合并 gitk git-gui



I find myself referring to the root commit for various reasons. I usually make a tag called first or root to make it easier, but I have been dealing with quite a few repositories lately and even this manual tagging is getting quite tedious.

Is there an easy way to refer to the root commit, something similar to HEAD or FETCH_HEAD?

解决方案

I only see tagging that first commit relevant for you as the only current solution.
That way, you can refer to it through a well named tag instead of looking for its SHA1 through the log.

Note: there can be several "root" commits in a Git repo (i.e. several commits without any parent)
See for instance this thread, with Jakub Narębski's answer:

Not to mention that you can have multiple roots (multiple commits with no parent) in git repository.
Besides independent branches (like 'man', 'html' or 'todo') it is usually result of absorbing or subtree-merging other projects.
In 'master' branch there are 5 roots or more: joined 'git-tools' (mailinfo / mailsplit), absorbed gitweb, and subtree-merged gitk and git-gui.

这篇关于是否有一个特殊的名称(如HEAD,FETCH_HEAD)用于git仓库当前分支上的根提交?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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