Home > Mobile >  What means to execute `git tag` with the branch name?
What means to execute `git tag` with the branch name?

Time:11-17

In this zsh robbyrussell themed shell

If I execute git status I'm still on task/XXXX-251 branch but I didn't get why my prompt changed. If you know oh-my-zsh robbyrussell theme and want to clarify this other part I'd appreciate!

CodePudding user response:

What means to execute git tag with the branch name?

git tag adds a tag that points to a commit. Branches point to a commit. git tag <tagname> <branch> means to tag the commit the branch points to. git tag <tagname> without a branch means to tag current HEAD.

The presented command does not use branch name.

git tag -am "Tag..." release-${BITBUCKET_BUILD_NUMBER}
                                                         ^^^^ - no branch
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - tag name
            ^^^^^^^^ - tag message
          ^          - next argument is a message

it's same as, i.e. you can mix flag arguments with positional arguments:

git tag -a v1.0 -m "My v1.0"
                   ^^^^^^^^^ - tag message
                ^^           - next argument is a message|
           ^^^^              - tag name
  • Related