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>
    
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章