Why do I need to do `--set-upstream` all the time?

后端 未结 21 2418
南方客
南方客 2020-11-22 09:15

I create a new branch in Git:

git branch my_branch

Push it:

git push origin my_branch

Now say someone mad

21条回答
  •  面向向阳花
    2020-11-22 09:16

    For what it is worth, if you are trying to track a branch that already exists on the remote (eg. origin/somebranch) but haven't checked it out locally yet, you can do:

    $ git checkout --track origin/somebranch
    

    Note: '-t' is the shortened version of '--track' option.

    This sets up the same association right off the bat.

提交回复
热议问题