Git 标签 - 结账问题

发布于 2024-11-29 08:51:13 字数 230 浏览 8 评论 0原文

如果一个Git项目中有多个可用的标签,我们如何检查当前所有标签中哪个是签出的标签。

git tag 将列出所有标签,条目将出现在 .git/refs/tags 中

,例如: - 今天我们从主存储库进行了存储库同步,并获得了标签 1,并且我们签出了标签 1并开始研究它,几周后我们同步了内容并检查了新标签。

现在,如果我想检查最新状态,即当前签出的标签 - 我们该怎么做?

If there are multiple tags available in a Git project, how can we check, which is the checked out tag out of all the present ones.

git tag will list all the tags, and entries will be present in .git/refs/tags

say for example: - today we did a repository sync from master repository and got tag 1 and we checkouted tag 1 and started working on it, few weeks later we synced the content and checked out new tag.

Now if I want to check the latest status, which is the current checked-out tag - how can we do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

时光病人 2024-12-06 08:51:13

git 描述告诉您工作副本引用的最新标签。

手册页摘录:

git-describe - 显示可从提交访问的最新标签

git describe tells you the most recent tag that your working copy refers to.

Excerpt from the man page:

git-describe - Show the most recent tag that is reachable from a commit

堇年纸鸢 2024-12-06 08:51:13

这里有很好的答案,但另一种有时更友好的方式是使用 gitk:

gitk --all

对于任何给定的提交,它都会向您显示之前和之后最近的标签,更不用说带有代表的标签和分支的提交图的图形布局

Good answers here, but another, and sometimes friendlier way, is with gitk:

gitk --all

For any given commit, it will show you the nearest tags both before and after it, not to mention the graphical layout of the commit graph with tags and branches represented

不乱于心 2024-12-06 08:51:13

这将为您提供提交祖先中最新标签的列表,我认为这就是您所要求的:

  git log --format=format:%d --tags

提交祖先中的最新标签将位于顶部。

您还可以使用:

  git log --decorate

它为您提供正常的 git 日志,并将标签添加到提交中。

This gives you a list of the most recent tags in your commit ancestry, which I think is what you are asking for:

  git log --format=format:%d --tags

The most recent tag in your commit ancestry will be at the top.

You can also use:

  git log --decorate

which gives you the normal git log with the tags added to the commits.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文