Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to move branch in SourceTree into Folder?

Tags:

I have the following branch structure in git:

master  feature-2 bugfix/bug-1 feature/feature-1 

Now I want to move branch feature-2 into the feature folder.

How do I move branches into folders? Either via SourceTree or the git command line.

like image 686
stevek-pro Avatar asked May 22 '15 16:05

stevek-pro


People also ask

How do I move a branch in Sourcetree?

If you mean to switch to a different branch in the Sourcetree, just click on your branch in the left side tab and choose Checkout or just double click on the branch to check out. Then you can use pull to get updates from remote branches. Thanks, Ram.

How do I add a branch to Sourcetree?

Create a branch and make a change Let's create a branch so that you can list the speakers in your supply requests file. From Sourcetree, click the Branch button. From the New Branch or Create a new branch field, enter wish-list for the name of your branch. Click Create Branch or OK.


2 Answers

SourceTree seems to display "folders" for branches that have the same folder/structure in their branch names.

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.

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 display features as a folder.

https://answers.atlassian.com/questions/200282/sourcetree-categorize-branches

like image 154
pkamb Avatar answered Sep 18 '22 13:09

pkamb


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 
like image 31
Alexey Andrushkevich Avatar answered Sep 20 '22 13:09

Alexey Andrushkevich