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

后端 未结 15 1333
逝去的感伤
逝去的感伤 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:04

    In Git 1.7.0 and later, you can checkout a new branch:

    git checkout -b 
    

    Edit files, add and commit. Then push with the -u (short for --set-upstream) option:

    git push -u origin 
    

    Git will set up the tracking information during the push.

提交回复
热议问题