简体   繁体   中英

Clone a branch from repo and checkout with a local branch name

git clone <_url_> -b <_remote_branch_name_> clones the repo and checks out the branch that I specify in the argument. However, I end up with a local branch with the same name as the remote branch.

Is there a way to specify the local name of the branch that is checked out after cloning ?

I don't think it's possible using git clone but the branch can be renamed after cloning:

git clone <_url_> -b <_remote_branch_name_>
git branch -m <_remote_branch_name_> <_local_branch_name_>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM