Given a Git repository with a commit history:
git status
On branch master
nothing to commit, working directory clean
git log --oneline
Is it possible to create a new branch with no commits?
It is possible with the orphan
option, you definitely can!
git checkout --orphan orphan
Output:
Switched to a new branch 'orphan'
Delete all your existing files:
git rm -rf .
And now you have a branch with zero commits and files.
git status
On branch orphan
Initial commit
nothing to commit (create/copy files and use "git add" to track)