What to do if the git tags and branches have the same names?
PHP中文网
PHP中文网 2017-05-02 09:41:39
0
2
1327

For example, there is a tag called v1 and a branch also called v1, but they point to different commits. How do I distinguish the tag and branch when I checkout?

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(2)
为情所困

First of all, be sure not to use tags and branches with the same name. This will put the entire project team into the dilemma of "can you tell whether I am male or female".

"Unified naming standards are important! Unified naming standards are important! Unified naming standards are important!"

I really don’t know how to name it more appropriately. You can refer to Git FLOW

In addition, if there is a duplicate name, there are two ways to rebuild a branch with a meaningful name to solve the problem

git checkout -b new_branch old_branch 
git checkout -b new_branch <sha1>
Peter_Zhu

git checkout tags/v1

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template