美文网首页
git分支管理

git分支管理

作者: 啵啵_long_港 | 来源:发表于2018-10-24 17:56 被阅读7次

1、创建本地分支 local_branch

 git branch local_branch

2、创建本地分支local_branch 并切换到local_branch分支

git checkout -b local_branch

3、切换到分支local_branch

git checkout local_branch

4、推送本地分支local_branch到远程分支 remote_branch并建立关联关系

  a.远程已有remote_branch分支并且已经关联本地分支local_branch且本地已经切换到local_branch

      git push

 b.远程已有remote_branch分支但未关联本地分支local_branch且本地已经切换到local_branch

     git push -u origin/remote_branch

 c.远程没有有remote_branch分支并,本地已经切换到local_branch

    git push origin local_branch:remote_branch

5、删除本地分支local_branch

  git branch -d local_branch

6、删除远程分支remote_branch

 git push origin  :remote_branch

 git branch -m | -M oldbranch newbranch 重命名分支,如果newbranch名字分支已经存在,则需要使用-M强制重命名,否则,使用-m进行重命名。

git branch -d | -D branchname 删除branchname分支

git branch -d -r branchname 删除远程branchname分支

7、查看本地分支

  git branch

8、查看远程和本地分支

  git branch -a

==================删除分支==================

1.列出本地分支:

git branch

2.删除本地分支:

git branch -D BranchName

其中-D也可以是--delete,如:

git branch --delete BranchName

3.删除本地的远程分支:

git branch -r -D origin/BranchName

4.远程删除git服务器上的分支:

git push origin -d BranchName

其中-d也可以是--delete,如:

git push origin --delete BranchName

原文:https://blog.csdn.net/u013749540/article/details/78295420

相关文章

  • git常用命令

    分支管理 git 切换分支 git 查看远程分支 git 查看本地分支 git 创建本地分支 git 删除本地分支...

  • Git命令整理

    Git命令 ———————————————— git配置: git基本步骤: git分支管理: 创建分支命令: 切...

  • GIT分支管理

    GIT 分支管理 参考:在阿里,我们如何管理代码分支?GitHub Flow & Git Flow 基于Git...

  • git常用操作

    Basic Operation 分支管理切换分支git checkout git checkout -b #...

  • git提交代码规范管理

    GIT分支管理 git远程分支主要包括:master develop fixbugmaster:整个项目主分支,...

  • 2021-11-30

    一、分支管理 1、创建分支 git branch 2、查看分支 git branch...

  • git分支仓库管理

    git分支和标签管理 创建分支 git branch banchName git checkout -b bra...

  • git分支管理与使用规范

    git分支管理与使用规范 分支管理 flow git flow github flow gitlab flow f...

  • git 创建分支提交远程分支

    Git创建与管理远程分支 1.创建本地分支 git branch 分支名,例如:git branch 2.0.1....

  • 2016-06-24 阅读整理

    Git Git 基础命令Git 分支管理Git 分支合并Git 公钥提交Git 常用技巧Git 设置别名 Andr...

网友评论

      本文标题:git分支管理

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