常用git命令

来源:互联网 发布:2144剑雨江湖进阶数据 编辑:程序博客网 时间:2024/05/29 18:37

常用git命令

get最新的abbreviated commit hash

git rev-parse --short HEAD  git log -1 --pretty=format:"%h"

add/delete/list tags

  • List tags
git tag  git tag -l "v0.1*"
  • Add a tag to current HEAD
git tag -a v0.2.0 -m "Release 0.2.0"  
  • Adding a tag to a specific commit with commit_id=a34b6e
git tag -a v0.2.0 a34b6e -m "Release 0.2.0"  
  • Show the tag data
git show v0.2.0  
  • Push all tags
git push --tags  
  • Push a specific tag
git push origin v0.2.0  
  • Delete a local tag
git tag -d v0.1.0  
  • Remove a remote tag
git push origin :refs/tags/v0.1.0  

查看当前branch是从哪个tag创建的

git describe --tags
0 0
原创粉丝点击