問題:
I want to be able to do the following:我希望能夠做到以下幾點:
Create a local branch based on some other (remote or local) branch (via
git branch
orgit checkout -b
)基於其他(遠程或本地)分支(通過git branch
或git checkout -b
)創建本地分支Push the local branch to the remote repository (publish), but make it trackable so
git pull
andgit push
will work immediately.將本地分支推送到遠程存儲庫(發佈),但使其可跟蹤,以便git pull
和git 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