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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章