Editing Git branch
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 6: | Line 6: | ||
* [[main]] | * [[main]] | ||
− | |||
− | |||
[[git branch -a]] | [[git branch -a]] | ||
− | |||
− | |||
− | + | [[Create a new branch]]: | |
− | + | git branch new_branch | |
− | + | git checkout new_branch | |
− | |||
− | |||
− | [[Create a new branch]] | ||
− | |||
− | |||
− | |||
or | or | ||
* <code>[[git checkout -b]]</code> | * <code>[[git checkout -b]]</code> | ||
Line 28: | Line 18: | ||
[[master]] | [[master]] | ||
− | + | git branch --list or git branch -l | |
* [[main]] | * [[main]] | ||
Line 35: | Line 25: | ||
[[git branch --all]] | [[git branch --all]] | ||
− | + | git branch -r | |
origin/HEAD -> origin/main | origin/HEAD -> origin/main | ||
origin/[[main]] | origin/[[main]] | ||
Line 48: | Line 38: | ||
=== [[Rename branch]] === | === [[Rename branch]] === | ||
− | + | [[git checkout]] -f yourbranch | |
+ | [[git branch -M]] yourNewBranch | ||
=== Delete branch === | === Delete branch === | ||
Line 58: | Line 49: | ||
[[git branch]] | [[git branch]] | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Related commands == | == Related commands == | ||
Line 75: | Line 59: | ||
* [[git show-branch]] | * [[git show-branch]] | ||
* <code>[[git clone]]</code> | * <code>[[git clone]]</code> | ||
− | |||
== See also == | == See also == | ||
− | |||
* {{git branch}} | * {{git branch}} | ||
+ | * {{git}} | ||
+ | |||
[[Category:Git]] | [[Category:Git]] |
Advertising: