• Checkout a distant repository:

    $ hg clone http://bitbucket.org/mirror/django
    
  • Commit all changes locally:

    $ hg commit -m "Here is my commit fixing bugs."
    
  • Push local commits to the remote repository:

    $ hg push
    
  • Apply latest changes of the remote repository to our local working copy:

    $ hg pull
    
  • Align the current repository to a specific revision:

    $ hg update -r 502
    
  • Restore all changes and files to the state they are in the distant repository:

    $ hg update -C
    
  • My minimal ~/.hgrc config file:

    [ui]
    username = Kevin Deldycke <kevin@deldycke.com>
    verbose = True
    
    [auth]
    # BitBucket creds
    bb.prefix = bitbucket.org
    bb.username = kdeldycke
    bb.password = XXXXXXXXXXX
    bb.schemes = https
    
  • Display the last 5 commits:

    $ hg log --limit 5
    
  • Display the local changes since last commit:

    $ hg diff
    
  • Undo the last local commit:

    $ hg rollback
    
  • Create a tag on a particular revision:

    $ hg tag -r 432 component-2.6.1
    
  • Create a bundle file containing all changes committed locally:

    $ hg bundle fix-bug.bundle
    

Related content