Git(Linux环境):分支和标签的简单使用

目录

分支

查看分支:git branch

创建分支:git branch newbranch

切换分支(注意星号):git checkout  branch-name

案例

标签

添加标签:git tag tag-name

查看标签:git tag 

删除标签:git tag -d  tag-name

显示标签详细信息:git show tag-name


分支

查看分支:git branch

创建分支:git branch newbranch

切换分支(注意星号):git checkout  branch-name

案例

  • 在新分支new下创建main.c文件,并添加提交到版本库中

  • 查看日志

  • 在master分支下没有main.c文件,也不存在提交记录

  • 在new分支下有main.c

标签

添加标签:git tag tag-name

  • 软件开发到一个阶段,添加版本
  • 在new分支下,添加标签v1.0

查看标签:git tag 

删除标签:git tag -d  tag-name

显示标签详细信息:git show tag-name

猜你喜欢

转载自blog.csdn.net/baidu_41388533/article/details/108306202