The usual command is:
git checkout origin/branch_i_want -b branch_i_want
Git responds with:
Branch branch_i_want setup to track remote branch branch_i_want from origin.
This is fine.
My question is simple. Most of the time, the locally created branch has the same name as the remote branch. Is there a git command that does this so I do n开发者_运维技巧ot need to type the branch name twice?
In other words, is there something like:
git checkout --autocreate-tracking origin/branch_i_want
Which would, in theory create a local branch named branch_i_want and set it up to track origin/branch_i_want ?
With recent git (I think >= 1.7) you can just do git checkout -t remotename/branchname
, and -b branchame
is implied.
精彩评论