如何使用 Eclipse 重命名 git 分支名称

How to rename git branch name using Eclipse

我从 origin/master 创建了一个名为 origin/feature-BRANCH-NAME 的远程分支,但我不小心输入了错误的分支名称,我想使用 Eclipse 重命名它。

我该怎么做?

从 eclipse 内部:

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

重命名现有分支

  • 从项目节点上的团队菜单
  • Select 团队 > 高级 > 重命名分支...
  • 在分支 selection 对话框中,select 要重命名的分支
  • 输入新的分支名称并点击确定

Using git command line:

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

How to rename a remote branch?

删除旧分支并推送一个新名称的新分支

 # 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>