How do I push a new local branch to a remote Git repository and track it too?

后端 未结 15 1582
逝去的感伤
逝去的感伤 2020-11-22 09:17

I want to be able to do the following:

  1. Create a local branch based on some other (remote or local) branch (via git branch or git checkout

15条回答
  •  故里飘歌
    2020-11-22 10:18

    For GitLab version prior to 1.7, use:

    git checkout -b name_branch
    

    (name_branch, ex: master)

    To push it to the remote repository, do:

    git push -u origin name_new_branch
    

    (name_new_branch, example: feature)

提交回复
热议问题