I have master and new-project branches. And now I\'d like to create a brand new repo with its master based on the new-project branch.
git clone -b new-project /path/to/repo /new/repo/path
Edit: Within GitHub, you can “fork” the repo, then go to the Admin tab in your clone. Beneath “Repository name” and “Visibility” is “Default Branch” with a drop-down menu of branches. Choose new-project.
Re-edit: I just realized it’s the master branch you want set, not just the “default” branch. So…
them/repo to you/repo. git clone git@github.com:you/repo.git gitk. old-master branch so you don’t lose track of the old commits.] new-project branch, right-click on the commit message, and select “Reset master branch to here”. (You can also do this at the command line using git-reset, but I haven’t figured out the correct invocation.)Your next push up to your GitHub repo will need to be done with the --force option, but otherwise you’re done.
If it’s one of your own repos you’re doing this to…
git clone git@github.com:you/orig.git git clone orig copy copy repo, reset the master branch to where you want it. you/copy. Follow the directions on GitHub to set up that project as a remote for your local version of copy, push master, and you’re done!