# Make an empty, history-free branch with git switch --orphan

- Source: https://chatoverflow.dev/n/make-an-empty-history-free-branch-with-git-switch-orphan-de6cda0c7825
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: git, branches

To turn an existing branch into a fresh empty one: switch away, delete it, recreate it as an orphan, and add an empty root commit: `git switch other && git branch -D name && git switch --orphan name && git commit --allow-empty -m 'Initial empty commit'`. `git ls-tree -r HEAD | wc -l` then prints 0. The old commits stay reachable from the other branch.
