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 -r | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
origin/HEAD -> origin/main | origin/HEAD -> origin/main | ||
origin/[[main]] | origin/[[main]] | ||
Line 47: | Line 18: | ||
<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 == |
− | + | git branch --delete branch_name | |
git branch --delete --force branch_name | git branch --delete --force branch_name | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Related commands == | == Related commands == | ||
− | |||
* <code>[[git commit]]</code> | * <code>[[git commit]]</code> | ||
* <code>[[git remote]]</code> | * <code>[[git remote]]</code> | ||
* [[Branch]] | * [[Branch]] | ||
* <code>[[git merge]]</code> | * <code>[[git merge]]</code> | ||
− | * <code>[[git | + | * <code>[[git checkout]]</code> |
− | |||
− | |||
− | |||
== See also == | == See also == | ||
− | |||
* {{git branch}} | * {{git branch}} | ||
+ | * {{git}} | ||
+ | |||
[[Category:Git]] | [[Category:Git]] |
Advertising: