我最近开始使用GIT命令行命令(我曾经使用过SourceTree)。
当我想创建一个新分支时,我通常会git checkout -b <branch-name>
。
当我想把它推到遥控器时,我会做git push origin <branch-name>
。
现在我将此本地分支推送到远程后,如何使本地分支跟踪此远程分支? (我不希望我的本地分支跟踪主人)
答案 0 :(得分:2)
使用-u
:
$ git push -u origin localname:remotename
$ git help push
...
-u, --set-upstream
For every branch that is up to date or successfully pushed, add
upstream (tracking) reference, used by argument-less git-pull(1)
and other commands. For more information, see branch.<name>.merge
in git-config(1).