Difference between revisions of "Git checkout -b"
Jump to navigation
Jump to search
(Removed redirect to Git checkout) Tag: Removed redirect |
|||
(19 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
− | + | {{lc}} | |
− | git checkout | + | * https://git-scm.com/docs/git-checkout |
− | |||
+ | 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. | ||
+ | |||
+ | git checkout -b name_from_existing_branch | ||
+ | fatal: A branch named 'name_from_existing_branch' already exists. | ||
+ | |||
+ | === Create a new [[branch]] === | ||
+ | <code>[[git branch]] new_branch_name</code> | ||
+ | |||
+ | <code>[[git checkout]] new_branch_name</code> | ||
+ | |||
+ | <code>git push --set-upstream origin new_branch_name</code> | ||
+ | |||
+ | == Related == | ||
+ | * [[Create Git branch with current changes]] | ||
== See also == | == See also == | ||
* {{git checkout}} | * {{git checkout}} | ||
+ | * {{git branch}} | ||
[[Category:Git]] | [[Category:Git]] |
Latest revision as of 06:23, 27 April 2023
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.
git checkout -b name_from_existing_branch fatal: A branch named 'name_from_existing_branch' already exists.
Create a new branch[edit]
git branch new_branch_name
git checkout new_branch_name
git push --set-upstream origin new_branch_name
Related[edit]
See also[edit]
git checkout
[-b
|master | main | -f
]git branch
,git: upstream
,git branch --delete branch name
,[ --list | -a | -r | -M ]
Advertising: