简体   繁体   中英

Git branch directly from origin / master?

I don't keep a local copy of origin/master. Keeps me from screwing it up. That being the case, how can I create a new local branch directly from remote origin / master?

You can specify a branch to checkout from when using the -b option as shown in the git checkout documentation ;

git checkout -b master_copy origin/master

This will create a branch called master_copy based on the current head of origin/master .

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