Difference between revisions of "Git checkout -b"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
{{lc}} | {{lc}} | ||
− | + | Create a new branch and change to it: | |
− | Create a new | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
[[git checkout]] -b YOUR_NEW_BRANCH_NAME | [[git checkout]] -b YOUR_NEW_BRANCH_NAME | ||
Switched to a new branch 'YOUR_NEW_BRANCH_NAME' | Switched to a new branch 'YOUR_NEW_BRANCH_NAME' | ||
Line 13: | Line 6: | ||
git checkout -b "Name with spaces" | git checkout -b "Name with spaces" | ||
fatal: 'Name with spaces' is not a valid branch name. | fatal: 'Name with spaces' is not a valid branch name. | ||
+ | |||
+ | Create a new [[branch]]: | ||
+ | [[git branch]] new_branch | ||
+ | [[git checkout]] new_branch | ||
Revision as of 13:03, 5 December 2022
Create a new branch and change to it:
git checkout -b YOUR_NEW_BRANCH_NAME Switched to a new branch 'YOUR_NEW_BRANCH_NAME'
git checkout -b "Name with spaces" fatal: 'Name with spaces' is not a valid branch name.
Create a new branch:
git branch new_branch git checkout new_branch
See also
git checkout
[-b
|master | main | -f
]git branch
,git: upstream
,git branch --delete branch name
,[ --list | -a | -r | -M ]
Advertising: