git tag and git describe a specified path/commits/tags
一、git tag and describe
1. Create a tag with patterned name
git tag "tagname_v1.02"
(one tag is pointed to a specified commit)
2. get tag describe to use in software version name
git describe --tags --long --dirty=* --match "tagname*"
> tagname_v1.02-0-g59584af
3. push tag name to remote repo
3. push tag name to remote repo
git push origin <branchname> --tags
二、show log with tags
1. show git log with tags:
git log -tags
show tag with no ancestor and within one line:
git log --no-walk --tags --pretty="%h %d %s" --decorate=full
三、tag a specified commit
git log -tags
show tag with no ancestor and within one line:
git log --no-walk --tags --pretty="%h %d %s" --decorate=full
三、tag a specified commit
# Set the HEAD to the old commit that we want to tag
git checkout 9fceb02
# temporarily set the date to the date of the HEAD commit, and add the tag
GIT_COMMITTER_DATE="$(git show --format=%aD | head -1)" \
git tag -a v1.0 -m"v1.0"
注:
这个-m添加的信心只出现在git tag -l -n2里面
没有出现在git log/git log --tags里面
# push to origin
git push origin --tags
# set HEAD back to whatever you want it to be
git checkout master
参考资料:
https://stackoverflow.com/questions/4404172/how-to-tag-an-older-commit-in-git
https://stackoverflow.com/questions/4211604/show-all-tags-in-git-log
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架