Skip to content

branches #22553

Answered by Wabri
Jonyk56 asked this question in General
branches #22553
Jan 7, 2019 · 1 comment
Discussion options

You must be logged in to vote

To rename a branch you simply need to create a new one starting from the branch you want to rename. And when you create this new branch you can simply delete the old branch.

An example: I want to rename the branch called “old” to “new”. To do this with the command line you need to be in the “old” branch, so if you are not in this you need to switch to it:

git checkout old

Now you have to create a new branch and call it “new”:

git checkout -b new

The “old” branch is useless than you can delete that:

git branch -D old

if you have “old” also in remote repository you have to delete it with:

git push origin --delete old

Where origin is the remote repository.

Hope to solve your problem 🙂 

-…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants