1

I am using Visual Studio 2019 Community Edition for an asp.net project with Azure DevOps Git as the source control. I have been using this source control without issues for the past month.

But today, when I clicked on Commit and Push drop-down button in the Changes tab of Team Explorer then on viewing the history of project it showed a master tag for most recent commit/push that I had just made as shown in the screenshot below.

master tag in git history in visual studio 2019

Question

Why did the master tag suddenly appear for most recent commit/push and what does it mean? I had not input any tag for this commit/push but this was added by Azure DevOps automatically. Such a master tag never shows for any of the prior commits in the past month.

I have only 2 Git branches in my project - a local branch origin/master and a remote branch origin/master as in the screenshot below.

git branches in my visual studio project

Sunil
  • 20,653
  • 28
  • 112
  • 197
  • 1
    Agree with @Chad B, the master is not a tag, it is your local branch name. In visual studio history page, you will get these three options.https://i.stack.imgur.com/2WOHx.png. According to your attachment, I think you choosed the Show Localed Branches option. – Frank Wang-MSFT Oct 21 '19 at 05:50
  • @FrankWang-MSFT, You are right. I had `Show Local Branches` enabled in toolbar of history window. It seems enabling this only shows the local branch for latest commit; the older commits are not showing the local branch. – Sunil Oct 21 '19 at 07:16

2 Answers2

3

This is not a tag. It is letting you know that's the commit to which the master branch currently points.

The toolbar in the History window has three buttons on it where you can toggle seeing local branches, remote tracking branches, and tags labeled onto the corresponding commits. By default, branches are rendered red and tags are green. Hovering the mouse over the label should also tell you if it's a branch or tag. In your example above, I believe the tooltip would say "Head for branch master".

Hope this helps.

Chad B
  • 1,416
  • 9
  • 12
1

A tag named master does not mean anything. But by the same token, the branch name master does not mean anything either. The meaning, if there is one, is whatever you think it is.

It's unwise to use the same name for a branch and a tag. Git handles this just fine, but humans get confused.

Lightweight tags have no additional information, but annotated tags record the person who creates them, in much the same way that commits record the person who creates them. If this is an annotated tag, inspect it—git show refs/tags/master will do the trick for instance1—and then ask the person who created it what they thought they were doing and what name they'd like you to use instead, and then rename or delete the tag. (If the person turns out to be you, ask yourself why you did that. :-) )


1Actually, so will git show master: some Git commands, including git show, "prefer" the tag when it's ambiguous like this. Note that git checkout effectively prefers the branch though. That's why people get confused: they don't know whether master means refs/heads/master or refs/tags/master.

torek
  • 448,244
  • 59
  • 642
  • 775
  • So, is the master tag that shows for most recent commit insignificant? It doesn't show for any of the past commits, so it makes me believe there is some meaning to that master tag. – Sunil Oct 18 '19 at 06:20
  • Also, I did not input a tag for this commit, but it appeared by itself after it was committed/pushed successfully. – Sunil Oct 18 '19 at 06:26
  • Remote-tracking names (such as `origin/master`) are automatic. Tag names never are: the idea behind tags is that humans should create them and attach them to commits that have some particular significance to those humans. Tool-type software, such as Git, should never create them on its own. – torek Oct 18 '19 at 15:23