Clone your branch to a new git repo and preserves all the commit history

There is a case when you develop a project start with an experiment branch or normally create branch to try different version (ie. mobile or web) but then the branch growing stable or finally find out it should not locate under the same repo anymore where no longer any relationship with the original master branch. So there is a requirement to clone your branch over a new repo but still preserves all the commit history and changes. Here is the solution.

  1. Create a new repo.
  2. Under your working directory (switch to branch)

    git push http://github.com/user/new_repo.git +old_branch:master
    
  3. Done.

source from http://stackoverflow.com/questions/9527999/how-do-i-create-a-new-github-repo-from-a-branch-in-an-existing-repo