1
我使用git版本1.7.7.5。如何在Git中一次獲取並簽出?
是否可以使用一個git命令執行以下操作?
git fetch [email protected]:someone/repo.git someones_branch
git checkout FETCH_HEAD -b my_testing_branch
我使用git版本1.7.7.5。如何在Git中一次獲取並簽出?
是否可以使用一個git命令執行以下操作?
git fetch [email protected]:someone/repo.git someones_branch
git checkout FETCH_HEAD -b my_testing_branch
請注意,您可以設置my_testing_branch
的上游分支git branch --set-upstream my_testing_branch someone/someone_branch
(這裏使用遠程名爲「有人」)
,簡單的git拉就可以了(但仍然需要:git checkout my_testing_branch
+ git pull
)
要回答你的問題,一種方法是定義git alias
git config --global alias.fetch-github '"!f() { git fetch [email protected]:$1/$2.git $3 ; git checkout FETCH_HEAD -b $4 }; f"'
你會使用它,像這樣:
git fetch-github someone repo someone_branch my_testing_branch