How to push new branch to remote repository with tracking option
This question already has an answer here:
Push with the -u
option:
git push -u origin <branch>
-u
, short for --set-upstream
, that is set the upstream in origin
to the <branch>
name. If you omit the branch name, the local branch name is used instead. Full story on Git's documentation.
You would have created a feature branch from mainstream branch by
git checkout -b <branch>
So you can push this local branch to server by using below command. -u option is to set the upstream for your branch.
git push -u origin <branch>
This will push the local branch to remote.
Going forward, keep on add/edit the files in this branch and commit
git add <file>
git commit -m "message to commit"
then just push your changes, without -u option.
git push origin <branch>
链接地址: http://www.djcxy.com/p/4634.html
下一篇: 如何使用跟踪选项将新分支推送到远程存储库