美文网首页
git 分支管理 推送本地分支到远程分支等

git 分支管理 推送本地分支到远程分支等

作者: Mark_ZSQ | 来源:发表于2019-11-05 16:01 被阅读0次

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

相关文章

  • Git 新建本地分支并推送到远程

    1,本地新建分支并切换到新分支 git checkout -b 分支名 2,推送本地分支到远程 git push ...

  • git常用命令

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

  • git 常用命令

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

  • 本地git项目,添加github远程地址

    进入本地仓库 添加远程地址git remote add origin [远程地址] 推送本地分支到远程分支git ...

  • git 分支管理 推送本地分支到远程分支等

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

  • Git常用命令

    基础操作 远程库操作 查看远程库 添加远程库 推送本地分支到远程仓库 删除远程库 新建远程分支 合并分支 git ...

  • git分支操作

    git创建本地 创建本地分支并切换到新建分支 等同于下面两行 推送到远程分支 将新建的本地分支推送到远程分支 de...

  • Git之奇淫技巧

    git - 更改本地分支名称 & 远程分支 git - 删除本地分支 & 远程分支

  • Github

    推送到远程库 本地分支跟踪远程分支 当远程分支和本地分支连接上的时候,本地添加内容在文件中,git status会...

  • git 和 github

    分支管理 查看本地分支 查看远程分支 查看所有分支 创建分支 切换分支 将新分支推送到github 删除本地分支 ...

网友评论

      本文标题:git 分支管理 推送本地分支到远程分支等

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