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

问题:

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 -b )基于其他(远程或本地)分支(通过git branchgit checkout -b )创建本地分支

  2. Push the local branch to the remote repository (publish), but make it trackable so git pull and git push will work immediately.将本地分支推送到远程存储库(发布),但使其可跟踪,以便git pullgit push将立即工作。

How do I do that?我怎么做?

I know about --set-upstream in Git 1.7, but that is a post-creation action.我知道 Git 1.7 中的--set-upstream ,但这是创建后的操作。 I want to find a way to make a similar change when pushing the branch to the remote repository.我想找到一种在将分支推送到远程存储库时进行类似更改的方法。


解决方案:

参考一: https://en.stackoom.com/question/BbPZ
参考二: https://stackoom.com/question/BbPZ
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章