We are using a git repository to store our project. We have our branches departing from the original branch. But now we want to create a small new project to track some docu
The best solution is to create a new branch with --orphan option as shown below
git checkout --orphan
By this you will be able to create a new branch and directly checkout to the new branch. It will be a parentless branch.
By default the --orphan option doesn't remove the files in the working directory, so you can delete the working directory files by this:
git rm --cached -r
--orphan does:
--orphan
Create a new orphan branch, named, started fromand 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.
The index and the working tree are adjusted as if you had previously run git checkout
This can be useful when you want to publish the tree from a commit without exposing its full history. You might want to do this to publish an open source branch of a project whose current tree is "clean", but whose full history contains proprietary or otherwise encumbered bits of code.
If you want to start a disconnected history that records a set of paths that is totally different from the one of