简体   繁体   中英

github create same tag for both the master and gh-pages

I've created a repository on Github, and at some point I've created a tag on the master. Now for the branche gh-pages I want to create a tag also with the same name. But thats not possible. I can see that the tag only applies to the master, so why can't I apply the same tag name on different branches ?

cheers Luca

You can't apply the "same tag" multiple times, as a tag is there to reference one and only one commit.
(See " Tag multiple branches in git? " for more)

If you git checkout -b gh-pages from master , then you will be on a commit referenced both by master and the new branch gh-pages .
In that instance, one tag would be valid for both branches.

But once you start to create new commits in the new branches, you will apply one uniquely named tag to commits in that new branch only.

Kep in mind however that a tag isn't linked to a branch (if you were to rebase that branch on top of master , and then merge master ... you would end up again with one HEAD referenced by the two branches: all the tags would be again part of the two branches).
A tag is only linked to a commit.


Update August 2016: Simpler GitHub Pages publishing now allows to keep your page files in a subfolder of the same branch (no more gh-pages needed):

现在,您可以在存储库设置中选择一个源,然后GitHub Pages将在其中查找您的内容。

So here, you could tag master , referring to both contents.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM