Reputation: 171321
I use git version 1.7.7.5.
Is that possible to do the following using one git command?
git fetch [email protected]:someone/repo.git someones_branch
git checkout FETCH_HEAD -b my_testing_branch
Upvotes: 1
Views: 192
Reputation: 1323393
Note that you can set the upstream branch of my_testing_branch
git branch --set-upstream my_testing_branch someone/someone_branch
(here using a remote named 'someone')
And simply git pull on it (but that would still require: git checkout my_testing_branch
+ git pull
)
To answer your question, one way would be to define a git alias
git config --global alias.fetch-github '"!f() { git fetch [email protected]:$1/$2.git $3 ; git checkout FETCH_HEAD -b $4 }; f"'
You would use it like so:
git fetch-github someone repo someone_branch my_testing_branch
Upvotes: 2