Rename a local branch
Description: Rename the branch fix-hedaer (a spelling mistake) to fix-header.
Hint:
- Use
git branch -m old new.
Solution
Terminal output
$ git branch -m fix-hedaer fix-header
$ git branch
fix-header
* main
How it works
-mmeans move (rename). Only the name changes, not the commits.- If the branch was pushed, push the new name and delete the old name on the remote.
Read Git Branch.
Learn more about the similar topics:
| Tutorials |
|---|
| No Content Found. |
| Exercises & Assignments |
|---|
| No Content Found. |
| Interview Questions & Answers |
|---|
| No Content Found. |