Git: Renaming a Branch

git:-renaming-a-branch

Git branches are an easy way to manage our code, and separate our copies of our code when we want to work on specific features. We can then merge our code back into our main branch, or even rebase it.

Sometimes, though we make a mistake in the naming of our branch. Maybe you wrote fea-ui-design instead of feat-ui-design, or maybe you just want to rename your branch completely. Fortunately, it’s easy to rename a branch. First switch to the branch you want to rename using checkout:

git checkout my-branch

And then use the -m option on branch to rename it.

git branch -m new-branch

Now my-branch has been renamed to new-branch – it’s as easy as that!

Total
1
Shares
Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post
git-merge:-merging-changes-from-other-branches

Git Merge: Merging Changes from other Branches

Next Post
remember-to-enjoy-it

Remember to enjoy it

Related Posts