4

We have a branch called ABC-Awsome_Branch , that is "saved" in feature/3.0.0, so it looks like: feature/3.0.0/ABC-Awsome_Branch

But the branch was created with an incorrect name, and even not in the correct folder. So the correct path/name had to be like: feature/2.5.0/DEF-Awsome_Branch . Now this branch contains some commits, etc...

It's possible to "move" and rename the branch to the correct name and path?

We use Bitbucket , and sourcetree.

1

1 Answer 1

5

This should do the trick:

git branch -m old_branch new_branch         # Rename branch locally    
git push origin :old_branch                 # Delete the old branch    
git push --set-upstream origin new_branch   # Push the new branch, set local branch to track the new remote

Source here

Do not forget to pull before you do this, so you won't lose anything that was not previously pulled.

1
  • @Shudy - if this answer was helpful, please mark as "answer"
    – Ori
    Oct 17, 2017 at 13:06

Not the answer you're looking for? Browse other questions tagged or ask your own question.