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

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

    If you are not sharing your repo with others, this is useful to push all your branches to the remote, and --set-upstream tracking correctly for you:

    git push --all -u
    

    (Not exactly what the OP was asking for, but this one-liner is pretty popular)

    If you are sharing your repo with others this isn't really good form as you will clog up the repo with all your dodgy experimental branches.

提交回复
热议问题