How to create a Orphan Branch in SourceTree?

cyberpunkstudio June 21, 2014

In SourceTree you can create branches with no problem, but how do you create a Orphan branch?

2 answers

1 accepted

2 votes
Answer accepted
Jamus Jegier June 21, 2014

I was researching this the other day, and couldn't find an answer to it either. Best bet is to do it from the command line. In sourcetree, click on terminal, then run git checkout --orphan NEWBRANCH.

zhezhang October 2, 2016

Additional info: after running 

git checkout --orphan <NEWBRANCH>

You can run 

git rm -rf .

to clear the index and the working tree right after creating the orphan branch.

0 votes
Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 22, 2014

I do not believe SourceTree provides a way to do this in the UI. I imagine usage of "orphan" branches is so rare that if they DID support it, they would have more people using it on accident and panicking ("WHERE DID MY FILES GO?!?!?!?!1111") than they would have people using it on purpose.

Additionally, the required command is so simple, it doesn't really add a huge burden to those of you who have a legitimate use.

Bharath Lohray February 22, 2015

such people should not use git.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events