美文网首页
git常用命令

git常用命令

作者: 百里江山 | 来源:发表于2020-04-23 10:29 被阅读0次

提交代码

1. 本地提交代码

git add . 
git commit -m "备注"

2. 远程提交代码

git push origin master

分支

1. 创建分支

创建一个新分支new-branch,并分支至new-branch
git checkout -b new-branch

2. 远程指定分支

  1. clone 指定分支-b 指定远程分支,默认为master分支.
    git clone 远程clone地址 -b 远程分支名
  2. checkout 远程指定分支
    git checkout -b 本地分支名 origin/远程分支名

3. 删除本地分支

删除my-branch分支
git branch -D my-branch

4. 删除远程分支

删除远程分支target-branch
git push origin --delete target-branch

tag 标签

1. 查看tag

git tag

2. 添加tag

git tag v1.0.0
or
git tag -a v1.0.0 -m "备注"

3. 删除本地tag

git tag -d v1.0.0

4.删除远程tag

git push origin :refs/tags/v1.0.0

相关文章

网友评论

      本文标题:git常用命令

      本文链接:https://www.haomeiwen.com/subject/vdmbmhtx.html