git 如何从 TortoiseGit 重命名我的分支?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36133271/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I rename my branch from TortoiseGit?
提问by Dombi Soma
I know the way to rename branch from command line, but - since I'm using TortoiseGit- I'm curious if there are any options to do such thing.
我知道从命令行重命名分支的方法,但是 - 因为我使用的是TortoiseGit- 我很好奇是否有任何选项可以做这样的事情。
Thanks for the answers :)
感谢您的回答:)
回答by Harmelodic
In a File Manager, Open your Project root directory (where your .git
folder is found).
在文件管理器中,打开您的项目根目录(您的.git
文件夹所在的位置)。
Right click and go to:
右键单击并转到:
TortoiseGit > Switch/Checkout
Ensure the Switch To
Option to Branch
. Then click the little button to the side of the drop down menu that is denoted by ...
确保Switch To
选项为Branch
。然后单击下拉菜单旁边的小按钮,表示为...
A window will pop up showing the list of branches for you to choose.
Click on the one you want to rename.
将弹出一个窗口,显示分支列表供您选择。
单击要重命名的那个。
Hit F2.
击中F2。
Rename your branch. Hit Enter. Click OK.
重命名您的分支。击中Enter。单击OK。
Now in the drop down menu, you'll find that the branch-name has been updated.
现在在下拉菜单中,您会发现分支名称已更新。
回答by MrTux
If you want to rename a branch which is not the current branch, open the Reference Browser using the context menu of a versioned folder (you might need to hold the Shiftkey when opening it).
如果要重命名不是当前分支的分支,请使用版本化文件夹的上下文菜单打开参考浏览器(Shift打开它时可能需要按住键)。
select the branch you want to rename and then press F2(or select rename in the context menu).
选择要重命名的分支,然后按F2(或在上下文菜单中选择重命名)。
See https://tortoisegit.org/docs/tortoisegit/tgit-dug-browse-ref.html
见https://tortoisegit.org/docs/tortoisegit/tgit-dug-browse-ref.html
回答by Aspak Rogatiya
If you want to rename just the local branch, you can refer to other answers. Please follow these steps to rename local and remotebranch.
如果只想重命名本地分支,可以参考其他答案。请按照以下步骤重命名本地和远程分支。
- Right click the repository -> TortoiseGit -> Browse References.
- 右键单击存储库 -> TortoiseGit -> 浏览参考。
- Select the branch you want to rename and hit F2button and type a new name. The branch is now been renamed locally.
- 选择要重命名的分支,然后按 F2按钮并键入新名称。该分支现已在本地重命名。
- Right click the renamed branch and select "switch/checkout to this.."
- 右键单击重命名的分支并选择“switch/checkout to this..”
- Now right click the repository and select "Git Commit -> "renamed branch"
- 现在右键单击存储库并选择“Git Commit ->“重命名分支”
- Git commit window will open. Type a commit message and tick the checkbox "Message Only" in the bottom left corner, and then click "Commit & Push"
- Git 提交窗口将打开。输入提交消息并勾选左下角的“仅消息”复选框,然后单击“提交并推送”
Press the upvote button if this answer has helped you.
如果此答案对您有帮助,请按投票按钮。