gitbranchtagging

How do I determine what branch I have checked out in git?


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 I'm on.

In SVN I would do a svn info to figure out what branch I'm using.

How do I determine what branch/tag I am on?


Solution

  • git branch
    

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

    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.