如何确定我已在git中签出的分支/标签? [英] How do I determine what branch/tag I have checked out in git?

查看:105
本文介绍了如何确定我已在git中签出的分支/标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 git clone https://gerrit.wikimedia.org/r/p/mediawiki/core.git w / 克隆源。然后我通过执行 git checkout< tag name> git checkout origin / REL< release number> 。有时我忘记了我所在的分支或标签。

I clone my source using git clone https://gerrit.wikimedia.org/r/p/mediawiki/core.git w/. Then I specify a specific branch/tag by doing git checkout <tag name> or git checkout origin/REL<release number>. Sometimes I forget what branch or tag I'm on.

在SVN中,我会执行 svn信息来确定我正在使用的分支/标记(我意识到git对分支 tag 有不同的定义,但就我的目的而言,它们是相同的)。

In SVN I would do a svn info to figure out what branch/tag I'm using (I realize that git has distinct definitions for branch and tag but for my purposes they are the same).

如何确定我在哪个分支/标签上?

推荐答案

git branch

告诉您所在的分支(带有 * 标记)。

tells you what branch you're on (with a * marker).

标签只是修订的名称,因此Git不会告诉您您在标签上,但是您可以使用 git name-rev HEAD 来了解它的含义。

Tags are just names for revisions, so Git won't tell you that you're "on" a tag, but you can use git name-rev HEAD to get a sense for what it might be.

这篇关于如何确定我已在git中签出的分支/标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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