你如何在git中使用标签来管理软件版本 [英] How do you use tags in git to manage software versions
问题描述
我们使用git来管理我们的项目,我们有一个分支:
dev
staging
production
我想使用git标签来管理软件的版本。据我可以看到,如果我在一个分支,并添加一些提交,然后我必须运行:
git标签1.0
使用任何版本号,我可以使用:
git push origin 1.0
我可以更新分支:
git push --tags
但是,我现在如何重用标签?如果我向本地存储库提交更多代码,并且希望它能够轻松地成为1.0版本?或者你只是添加一个新的标签,如1.1?
另外,如果我的同事在他的本地存储库上使用相同的标签名称,相同的标签?
最后,如果我们意外推送我们的代码而未运行git标签来标记提交,会发生什么情况。
我没有真正了解标签是如何工作的,我认为他们会像标记博客文章或其他东西一样工作 - 您可以使用相同的标签对许多不同的提交进行标记,并重复使用标签等。我想。
我以前有类似的问题。这里是我发现有帮助的:
We use git to manage our project, we have a branch for each: dev staging production
I want to use git tags to manage versions of the software. As far as I can see if I am on a branch and add a few commits, I then have to run: git tag 1.0
Repacing 1.0 with whatever version number we are up to, then I can push the tag using: git push origin 1.0
And I can update the branch with: git push --tags
But how do I reuse a tag now? If I commit more code to my local repository and want it to be version 1.0 easily? Or do you just add a new tag like 1.1?
Also, what happens if my colleague uses the same tag name on his local repository and we both push the code for that same tag up?
Lastly, what happens if we accidentally push our code without running git tag to tag the commits.
I'm not really getting how tags work, I thought they would work like you would tag a blog post or something - you can tag lots of different commits with the same tag and reuse the tag etc. kind of like a branch I guess.
I've had similar problem before. Here is what I've found helpful:
这篇关于你如何在git中使用标签来管理软件版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!