Reputation: 31
I am trying to find out which branch tag was created from? I have clone tag and ran following command but it return two branches. Tag can be generate from one branch I do not know why it return two branches.
Following command i have executed
it return two branches. I created tag from why it return two branches? remotes/origin/dev-genericrequest remotes/origin/release-dev
Upvotes: 1
Views: 848
Reputation: 63
git branch -a --contains v1.0.0.0.1
This command is querying all git branches containing the existing tag v1.0.0.0.1
. It returns two branches because both of them contain the commit this tag points to.
From the official 'git branch' doc:
With --contains, shows only the branches that contain the named commit (in other words, the branches whose tip commits are descendants of the named commit),
Upvotes: 0
Reputation: 5187
A tag is simply a reference to a commit, it has no relation to a branch. A commit may be part of the history of many branches, or none at all.
Consider:
master
branch.master
hi
development
. At this point, both the development
and master
branches contain the same commit historymaster
and development
, but the tag
I added will show up for both branches, as well as any new branches that are made from a commit at or after the tagged one.I'm sure that if you check out each branch, you'll find that the commit referenced by your tag exists in the histories of both. If you visualise it like a tree branch, the tag must have existed before the "split" between the two branches occurred.
Upvotes: 3