All posts

I blew away three weeks of work with one command.

Git reset. Mercurial. Two worlds. One problem: undoing changes without burning down your project history. If you’ve ever switched between Git and Mercurial, you know that each has its own way of rewriting history, cleaning up commits, and moving your branch pointer around. But the mental model can be slippery. That’s why knowing how Git reset maps to Mercurial’s commands will save you hours of damage control. What Git Reset Actually Does In Git, reset moves the current branch to a specific co

Free White Paper

DPoP (Demonstration of Proof-of-Possession) + GCP Security Command Center: The Complete Guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free. No spam. Unsubscribe anytime.

Git reset. Mercurial. Two worlds. One problem: undoing changes without burning down your project history. If you’ve ever switched between Git and Mercurial, you know that each has its own way of rewriting history, cleaning up commits, and moving your branch pointer around. But the mental model can be slippery. That’s why knowing how Git reset maps to Mercurial’s commands will save you hours of damage control.

What Git Reset Actually Does

In Git, reset moves the current branch to a specific commit, optionally updating the working directory and the staging area.

  • git reset --soft changes the commit position but keeps files as staged.
  • git reset --mixed keeps your working files but un-stages changes.
  • git reset --hard wipes both staging and working copies to match the chosen commit.

It’s precise and unforgiving, which is the point. But that also makes it dangerous if you don’t have a backup.

Mercurial’s Way of Rewriting

Mercurial doesn’t have a direct one-word equivalent to git reset. Instead, there are several approaches:

  • hg update -C [rev]: Similar to git reset --hard. Discards uncommitted changes and moves to the specified revision.
  • hg backout [rev]: Generates a new commit to undo an earlier one, keeping a clean history.
  • hg strip [rev] (requires the strip extension enabled): Removes changesets and everything after them, like a permanent reset. This is closest to Git’s destructive reset.

Where Git’s reset alters the branch reference in place, Mercurial’s defaults lean toward creating new history or cleanly rolling back without rewriting for everyone.

Continue reading? Get the full guide.

DPoP (Demonstration of Proof-of-Possession) + GCP Security Command Center: Architecture Patterns & Best Practices

Free. No spam. Unsubscribe anytime.

Mapping the Mental Model

When moving between systems, think of Git reset as a pointer jump plus possible wipe of the working tree. In Mercurial, it’s often a dance between update, backout, and strip. Git’s reset can be quick and brutal. Mercurial builds in safer defaults but gives you the tools to go full destructive if needed.

The cross-compatibility tricks:

  • git reset --soft <rev> → Not a common Mercurial workflow, but you can bookmark a changeset, update to it, and keep changes in the working directory.
  • git reset --hard <rev>hg update -C <rev>
  • Removing commits entirely → hg strip <rev>

Avoiding Disaster Across Both Tools

Always check what your working tree holds before resetting or stripping. For Git, git status is your safety check. In Mercurial, hg status. Backup branches or use shelves in Mercurial for quick save-points.

Version control mistakes cost time and credibility. You can’t afford confusion when switching between toolchains, repos, or workflows.

And if you want to see a clean, hosted environment where you can experiment with Git and Mercurial commands side by side—without committing anything to production—spin it up on hoop.dev and watch it go live in minutes. The fastest way to reset without regret.

Get started

See hoop.dev in action

One gateway for every database, container, and AI agent. Deploy in minutes.

Get a demoMore posts