如何使用跟踪选项将新分支推送到远程存储库
这个问题在这里已经有了答案:
用-u
选项推送:
git push -u origin <branch>
-u
, --set-upstream
set --set-upstream
缩写,即将上游origin
设置为<branch>
名称。 如果省略分支名称,则使用本地分支名称。 关于Git文档的全文。
你可能已经从主流分支创建了一个功能分支
git checkout -b <branch>
所以你可以使用下面的命令将这个本地分支推送到服务器。 -u选项是为分支设置上游。
git push -u origin <branch>
这将推动本地分支到远程。
展望未来,继续添加/编辑这个分支中的文件并提交
git add <file>
git commit -m "message to commit"
然后只需推送您的更改,不需要-u选项。
git push origin <branch>
链接地址: http://www.djcxy.com/p/4633.html
上一篇: How to push new branch to remote repository with tracking option