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]]: <code>[[git checkout -b]]</code> | |
− | |||
− | |||
− | |||
− | |||
− | [[Create a new branch]] | ||
− | |||
− | |||
− | |||
− | |||
− | |||
git branch | git branch | ||
Line 28: | Line 14: | ||
[[master]] | [[master]] | ||
− | + | git branch --list or git branch -l | |
* [[main]] | * [[main]] | ||
Line 35: | Line 21: | ||
[[git branch --all]] | [[git branch --all]] | ||
− | + | git branch -r | |
origin/HEAD -> origin/main | origin/HEAD -> origin/main | ||
origin/[[main]] | origin/[[main]] | ||
Line 47: | Line 33: | ||
<code>git branch --set-upstream-to=origin/main main</code> | <code>git branch --set-upstream-to=origin/main main</code> | ||
− | === | + | === Rename branch === |
− | + | [[git checkout]] -f yourbranch | |
+ | git branch -M yourNewBranch | ||
=== Delete branch === | === Delete branch === | ||
Line 58: | Line 45: | ||
[[git branch]] | [[git branch]] | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Related commands == | == Related commands == | ||
Line 75: | Line 55: | ||
* [[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: