Mercurial
Configuration
Show mercurial configuration (--debug
includes file paths)
Edit mercurial config (Scope: local -l
, user -e
, global -g
)
General Workflow
Create new mercurial repository
Show status of changed files in working directory
Show status relative to current folder or specified path
Add untracked files (all / specific)
Show diff of pending changes since last commit
Commit current changes
Pull in latest changes (fetches only, does not update working copy)
Summary and History Information
Repository summary, root directory and branch heads
Show last commit diff
Show commit history (summary / verbose / diffs)
Info about a specific file or commit (summary / diff)
Example history variations (-f
starts at your current commit and moves backwards)
Show a summary of the files that changed for a rev set
Search code history
Grep for a specific string in file history commit messages or diffs
Grep mercurial history over time range for changes (eg. for last week "date(-7)"
)
Amend Changes
Amend an existing commit with current changes (-m
to update commit message)
To amend and change the commit message via editor
Purge Changes
Abandon changes and update to clean master state
Remove untracked files (--all
to purge everything including ignored temp files)
Revert Changes
Revert changes to an uncommitted file (return to clean, pre-edit state)
Revert a file to an earlier version in history (.~1
for current parent)
Squash Commits
Fold the current commit to the specified revision
Combine the current commit with the previous commit
Split Diff
Check out the diff to split and uncheck the items you want to move to the next commit
Bookmarks
Add new bookmark to current commit
Add bookmark to specific commit
Show current bookmarks (local and all)
Delete existing bookmark
Rename existing bookmark
Move bookmark label (-f
is force, -r
is for revision identifier)
Show a list of new incoming remote bookmarks
Reorder, Combine or Delete Commits
Interactively reorder, combine, or delete commits
Remove commit completely
Rebase Commits
Move revision and decedents (commits below it not on target branch) to destination
Move revision and ancestors (commits above it) to destination
Recover from a failed rebase or merge
Resolve merge conflict and continue rebase (after manual fix)
Cherry Pick Commits
Cherry pick and move revisions onto destination (specify multiple revisions with "<rev-id1> + <rev-id2>"
)
Bisect
Reset bisect state to begin a fresh bisect, and mark the current state as bad
Choose a known good point as close to now as possible (eg. 7 days ago) and mark it as good
Check the state and mark as good or bad until the problem revision is found
End bisect and return to the current checkout revision
Bisect and run unit test per check (First reset and mark good/bad commits)
Sparse Checkout
Check current sparse config
Add sparse configs
Refresh sparse checkout
Backout Commits
Backout revisions one at a time in reverse order, from newest (top) commit to earliest (bottom) commit
Squash all backed out revisions to a single commit
Update the commit message with additional details including message, summary, test plan, reviewed by (self)
Commit ID
Commit IDs contain local and global unique identifiers separated by :
Last updated