X

Git: Create an unrelated / orphan / disconnected branch

git checkout [-q] [-f] [-m] --orphan  []

Create a new orphan branch, named <new_branch>, started from <start_point> and switch to it. The first commit made on this new branch will have no parents and it will be the root of a new history totally disconnected from all the other branches and commits.

[…]

This can be useful when you want to publish the tree from a commit without exposing its full history. […]

If you want to start a disconnected history that records a set of paths that is totally different from the one of <start_point>, then you should clear the index and the working tree right after creating the orphan branch by running git rm -rf . from the top level of the working tree. […]

Source: http://git-scm.com/docs/git-checkout/

git checkout --orphan newbranch  
git rm -rf .  
[...]
git add files  
git commit -m 'Initial commit'  

Source: http://stackoverflow.com/a/4288660

Maik:
Related Post
%%footer%%