如何在Git中标记较旧的提交? [英] How to tag an older commit in Git?
问题描述
我们是git的新手,我想在存储库的开始处设置一个标签。
我们的生产代码与开始的仓库相同,但从那时起我们进行了提交。
标签在开始时可以让我们将生产回滚到一个已知的稳定状态。
所以如何将标签添加到任意的,例如:
<$>解决方案 c $ c> git tag -a v1.2 9fceb02 -mMessage here
其中
9fceb02
是提交ID的开始部分。
然后,您可以使用
git push --tags origin master
您可以执行
git log
来显示所有在当前分支中提交id。
关于标记。
当前日期(例如,该值将显示在github发布页面上)。如果您希望标签与提交日期一致,请查看另一个答案。We are new to git, and I want to set a tag at the beginning of our repository. Our production code is the same as the beginning repository, but we've made commits since then. A tag at the beginning would allow us to "roll back" production to a known, stable state.
So how to add a tag to an arbitrary, older commit?
解决方案Example:
git tag -a v1.2 9fceb02 -m "Message here"
Where
9fceb02
is the beginning part of the commit id.You can then push them up using
git push --tags origin master
You can do
git log
to show all the commit id's in your current branch.There is also a good chapter on tagging in the Pro Git book.
Warning: This creates tags with the current date (and that value is what will show on a github releases page, for example). If you want the tag to be dated with the commit date, please look at another answer.
这篇关于如何在Git中标记较旧的提交?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文