-1

I want to start a job (with the runner in Gitlab) if I tag a branch with "Local" or "Online". When I tag a branch with "Local" the job doesn't know with which branch he has to do the job.

I want to push the branch with the last Tag "Local" on a testserver and the branch with the last "Online"-Tag on a Onlineserver.

The answer below is not enough because I get all branches which have the Tag on it. But I only want to know the last branch with this Tag

Git: How to find out on which branch tag is?

Crystal
  • 1
  • 1

2 Answers2

0

A Tag is not specific to any branch. A Tag is just a pointer to a commit. The commit, and therefore the tag, can be part of the history of multiple branches, as long as it's reachable from the branches HEAD commit. Finding all branches from which the tag is reachable is what is explained in the link you provided. (Git: How to find out on which branch tag is?)

For the tag, there is no discrimination of branches from which it is reachable. Thus, I do not think it is possible to "know the last branch with this Tag". What sould the "last" branch be by your definition?!

kowsky
  • 12,647
  • 2
  • 28
  • 41
0

with git log --decorate Local we see the branch and the time when i put the tag on the branch so it must be possible (or not?) to find out on which branch I tagged the last "Local"

sry I'm not allowed to post images:

PS C:\Users\webs> git log --decorate Local commit 301df8b05d866428b0df928580c8062a08245357 (tag: Local, origin/localbranch, localbranch) Author: Author Date: Thu Jul 20 15:59:13 2017 +0200

Crystal
  • 1
  • 1