Mistire T
Mistire T

Reputation: 13

How to rename git branch name using Eclipse

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?

Upvotes: 0

Views: 7839

Answers (1)

CodeWizard
CodeWizard

Reputation: 142094

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>

Upvotes: 4

Related Questions