git 如何将 SourceTree 中的分支移动到文件夹中?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30401763/
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 to move branch in SourceTree into Folder?
提问by stevek
I have the following branch structure in git:
我在 git 中有以下分支结构:
master
feature-2
bugfix/bug-1
feature/feature-1
Now I want to move branch feature-2
into the feature
folder.
现在我想将分支移动feature-2
到feature
文件夹中。
How do I move branches into folders? Either via SourceTree or the git command line.
如何将分支移动到文件夹中?通过 SourceTree 或 git 命令行。
回答by pkamb
SourceTree seems to display "folders" for branches that have the same folder/structure
in their branch names.
SourceTree 似乎为folder/structure
分支名称相同的分支显示“文件夹” 。
You should simply create a new branch called feature/feature-2
pointing at the same commit as your current feature-2
branch. Then push the new branch and delete the old one.
您应该简单地创建一个名为feature/feature-2
指向与当前feature-2
分支相同的提交的新分支。然后推送新分支并删除旧分支。
You can name your branches in a folder structure-like format and they appear as folders in SourceTree. For example you could name it as
features/issue_1539
and SourceTree will displayfeatures
as a folder.
您可以以类似文件夹结构的格式命名分支,它们在 SourceTree 中显示为文件夹。例如,您可以将其命名为
features/issue_1539
,SourceTree 将显示features
为一个文件夹。
https://answers.atlassian.com/questions/200282/sourcetree-categorize-branches
https://answers.atlassian.com/questions/200282/sourcetree-categorize-branches
回答by Alexey Andrushkevich
You can rename this branch:
您可以重命名此分支:
git branch -m feature-2 feature/feature-2
You can also create new branch and delete the old one:
您还可以创建新分支并删除旧分支:
git checkout feature-2
git checkout -b feature/feature-2
git branch -d feature-2