cheat sheets.

$ command line ruby cheat sheets
Initialize project

    hg init            # creates a new repository in the current folder
    hg init PROJECT    # creates an empty repository in a new folder called 
                       # PROJECT

    hg clone http://url.of/remote/repository

Add files and track them
    
    cd project
    (add files)
    
    hg add             # add all untracked files
    hg add [FILES]     # add the specified files on the next commit
    hg addremove       # add all new files, delete all missing files

    hg status          # show changed files in the working directory

    hg commit          # commit all outstanding changes
    hg commit -m "commit message"

Forget a change or file

    hg revert FILE  # existing changes are saved to FILE.orig
    hg forget FILE  # remove FILE from hg, not from working dir (WD)
                    # FILE is removed on next commit

Update project from remote

    hg pull     # pull changes from default remote repository

    hg update   # update WD to tip of history (default)
                # only works if there are no local changes

    hg merge    # attempt auto-merge; call 3-way merge for conflicts

    hg resolve [FILE] 
                # cleanly re-attempt 3-way merge from scratch
                # can also --(un)mark as resolved, or --list status

Create a patch for upstream

    hg export tip > patch.diff    # export last commit as diff
    hg export -g tip > patch.diff # git extended diff format
    hg export 2 4 > patch.diff    # export multiple commits