0

I created a remote branch called origin/feature-BRANCH-NAME from origin/master and i accidentally typed a wrong branch name and I want to rename it using Eclipse.

How can I do that?

CodeWizard
  • 128,036
  • 21
  • 144
  • 167
Mistire T
  • 13
  • 1
  • 5

1 Answers1

4

From within eclipse:

https://wiki.eclipse.org/EGit/User_Guide#Renaming_an_Existing_Branch

Renaming an Existing Branch

  • From the Team menu on a Project node
  • Select Team > Advanced > Rename Branch...
  • On the branch selection dialog, select the branch to rename
  • Enter the new branch name and click OK

Using git command line:

# rename a local branch
git branch -m origin/feature-BRANCH-NAM <newname>

How to rename a remote branch?

Delete the old branch and push a new one with the new name

 # delete the remote branch
 git push origin - -delete <old name>

 # checkout the new branch (after renamed as explained above)
 git checkout <local new branch>

 # push the new branch name
 git push origin <new name>
CodeWizard
  • 128,036
  • 21
  • 144
  • 167
  • The first method - from Eclipse IDE, don't change the remote branch, only the local connected – lingar Jun 02 '20 at 13:48