Home Knowledge Base Mercurial (hg): Distributed Version Control

Mercurial (hg): Distributed Version Control

Overview Mercurial is a distributed version control system (DVCS), released in 2005 (the same year as Git). Like Git, it allows every developer to have a full copy of the repository history.

Git vs Mercurial

Philosophy

Key Differences 1. Safety: Mercurial makes it hard to overwrite history (no force push by default). It uses "Phases" (Draft, Public) to prevent accidents. 2. Branching:

3. Staging: Mercurial commits all changed files by default. Git requires git add.

Commands

hg init
hg add file.txt
hg commit -m "Initial commit"
hg pull
hg update
hg push

Status Git won the war (GitHub, GitLab, Bitbucket all focus on Git). However, Mercurial is still faster and cleaner for massive monorepos. Facebook and Google use highly customized versions of Mercurial for their mega-repos.

"Git is MacGyver, Mercurial is James Bond."

githubhostingcollaboration

Related Topics

Explore 500+ Semiconductor & AI Topics

From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.