git switch --orphan gh-pages

Category: Git - Core

git switch --orphan gh-pages

Create a branch with no shared history

Creates a new branch that shares no commits with the current one, as if history started fresh. The index and working tree stay as they are. It is the standard trick for gh-pages and other content-only branches.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.