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

1. 创建本地分支

   git branch local_branch_name

2.创建本地分支并切换到此分支

   git checkout -b local_branch_name

3.创建关联远程分支的本地分支并切换到此分支

   git checkout -b local_branch_name remote_branch_name

4.切换到本地分支

   git checkout local_branch_name

5.推送本地分支到远程分支并建立关联关系

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

      git push

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

      git push -u origin/remote_branch_name

   c.远程没有对应的远程分支且本地已经切换到local_branch

      git push origin local_branch_name:remote_branch_name


猜你喜欢

转载自blog.csdn.net/u010954988/article/details/80731139