-
Delete untracked files from working directory.
hg purge -
To delete just the '.orig' files (which accumulate after merging)
hg purge -I **/*.orig --all -
Limit log to last X commits
hg log --limit <X> -
Limit log to only a specific named branch
hg log --only-branch <name> -
Move a bookmark to a different changeset
hg bookmark --rev <changeset> <bookmark name> -
Similar to git stash
hg shelveandhg unshelve -
Similar to git cherrypick
hg graft <changeset> -
Rollback last action
hg rollback -
Discard changes in a specific file (similar to git checkout )
hg revert <filename> -
Pushing changes
hg outgoingshows what will be pushed
hg pushpushes all changes on all branches by default (but doesn't push bookmarks)
hg push -b <branch>pushes named branch only
hg push -B <bookmark>push named bookmark
hg push --new-branch>needed if your push will create a new named branch -
Merging to @ and closing a branch
hg update @
hg merge my_branch
hg commit -m "Merge in @"
hg update my_branch
hg commit -m "Close branch my_branch" --close-branch
hg push
-
Stripping commits
```hg strip `` removes a changeset and any descendents
Has no effect if already pushed; if you push a commit that needs to be stripped, you need to have everyone who's pulled that commit strip locally, then strip on bitbucket. -
Reverting a strip
Mercurial saves backups here:<REPO>/.hg/strip-backup/
To recover the stripped commit:
hg unbundle .hg/strip-backup/99aae0c100b3-9d930854-backup.hg