DEV Community

Ethern Myth
Ethern Myth

Posted on

Create Orphan Git Branches Easily with git-newroot

Have you ever needed a Git branch with zero history — one that doesn’t track main or master or pull in unrelated changes?

Say hello to git-newroot — a CLI tool that creates clean orphan branches in seconds.


🔧 Why Use This?

Sometimes, you want a branch that:

  • Doesn’t inherit any commits from main
  • Is used for static sites (gh-pages), demos, or release snapshots
  • Won’t confuse GitHub with “main is behind” messages

That’s where an orphan branch comes in — and git-newroot makes it dead simple to create.


📦 Install (or use instantly)

# Global install
npm install -g git-newroot

# OR run it instantly without installing
npx git-newroot

# OR even better
git-newroot
Enter fullscreen mode Exit fullscreen mode

⚙️ Usage

git-newroot [branch-name]
Enter fullscreen mode Exit fullscreen mode

If no name is given, it defaults to version-1
Pushes to remote automatically if configured

🧪 Example:

git-newroot version-2
Enter fullscreen mode Exit fullscreen mode

➡️ Creates a new version-2 branch with no history, adds a README.md, commits it, and pushes it (if a remote exists).

🎥 Demo

Check out the full usage demo on GitHub:
👉 https://github.com/Ethern-Myth/git-newroot-demo

For package information:
https://www.npmjs.com/package/git-newroot

🔁 Real-world Use Cases

  • 🔄 Start over clean on a new idea

  • 🚀 Deploy static sites with a fresh branch

  • 🔒 Keep feature branches isolated from history

  • 🧪 Prototype freely without main or master pollution

Give it Try and walk away from manually recreating new branches.

Top comments (0)