Git——本地分支&远程分支

  • 创建本地分支并推送到远程仓库

    # 创建本地分支
    git checkout -b <localBranch>
    # 将本地分支推送到远程
    git push origin <localBranch>:<remoteBranch>
    # 将当前的本地分支绑定到远程
    git push --set-upstream origin <remoteBranch>
    # 然后就可以愉快地开发了
    
  • 拉取远程新分支

    # <locakBranch>: 设置远程分支在本地的命名
    # <remoteBranch>: 远程分支
    git checkout -b <localBranch> origin/<remoteBranch>
    
  • 删除分支

    # 删除本地分支
    git branch -d <localBranch>
    
    # 删除远程分支
    git push origin --delete <remoteBranch>
    
发布了18 篇原创文章 · 获赞 1 · 访问量 3363

猜你喜欢

转载自blog.csdn.net/SJ1551/article/details/100600092