Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Mercurial on GitHub

Mercurial on GitHub

An internal presentation on using Mercurial on GitHub.

Klemen Slavič

October 05, 2011

More Decks by Klemen Slavič

Other Decks in Programming


  1. Subversion vs. Mercurial • Distributed repositories • Branches are basically

    clones inside the same repository • Non-linear history • Revision numbers are local • Commits are offline • Moving and renaming is tracked • Central repository • Branches are copies inside same directory structure • Global linear history • Revisions numbers are sequential and global • Commits are online • Moving and renaming is a combination of delete/add
  2. Subversion workflow • Check out working copy o • Make

    changes o ... o • Commit changes o " • Update copy o
  3. Mercurial workflow • Clone a repository o • Work, slave!

    o ... o " " • Pull changes o o (if pull creates multiple heads) • Push changes o
  4. Mercurial • Commits are always local • You can push

    multiple commits at a time • Mercurial blocks a push where it would create multiple heads in the remote o In this case, pull changes, update, merge, commit and push
  5. Branches in Mercurial • Repositories can be treated as branches

    • When pulling, changes commited are added as a nameless branch • You can switch to a branch by using • Merging and commiting preserves current branch • To push a non-existant branch to remote, use
  6. Pushing changes • Always pull and update before pushing o

    – o hg merge (if two heads are created) o o • Don‘t push to main repository directly! Use Pull Requests.
  7. Sharing changes offline • You can run a local repository

    server to share changes offline (via ) o • Enables users to pull changes, but cannot push
  8. Setting up your environment • Create SSH key for GitHub:

    o o – – • create key named o • Copy the key to GitHub • Set up SSH key mapping o •
  9. Incoming and outgoing changes • To preview the incoming changes

    without pulling: o • To preview outgoing changes without pushing: o
  10. Working with GitHub • Pull changes from base repository and

    update o • Create local changes o • Commit o • Verify outgoing changes and push o o • If you‘re ready to push to base repository, create a pull request