<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2titles.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemtitles.css"?><rss xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Steve Losh</title><link>http://stevelosh.com</link><description>Latest updates from stevelosh.com</description><language>en-us</language><lastBuildDate>Wed, 16 Sep 2009 17:52:55 -0500</lastBuildDate><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/stevelosh" type="application/rss+xml" /><feedburner:feedFlare href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Ffeeds.feedburner.com%2Fstevelosh" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2Fstevelosh" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare href="http://www.bloglines.com/sub/http://feeds.feedburner.com/stevelosh" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Ffeeds.feedburner.com%2Fstevelosh" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2Fstevelosh" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare href="http://www.pageflakes.com/subscribe.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2Fstevelosh" src="http://www.pageflakes.com/ImageFile.ashx?instanceId=Static_4&amp;fileName=ATP_blu_91x17.gif">Subscribe with Pageflakes</feedburner:feedFlare><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item><title>hg-paste</title><link>http://feedproxy.google.com/~r/stevelosh/~3/gpt052osOqM/</link><description>&lt;p&gt;hg-paste adds an &lt;code&gt;hg paste&lt;/code&gt; command to Mercurial which can send diffs to various pastebin websites for easy sharing.  You can grab the code from the &lt;a href="http://bitbucket.org/sjl/hg-paste"&gt;repository&lt;/a&gt; on BitBucket.&lt;/p&gt;
&lt;p&gt;It was inspired by &lt;a href="http://www.pocoo.org/"&gt;Pocoo&lt;/a&gt;'s &lt;a href="http://dev.pocoo.org/hg/hgpaste/"&gt;hgpaste&lt;/a&gt; extension, but is designed to work with public pastebin websites instead of private installations of &lt;a href="http://dev.pocoo.org/projects/lodgeit/"&gt;LodgeIt&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;[TOC]&lt;/p&gt;
&lt;h2&gt;Installing&lt;/h2&gt;
&lt;p&gt;Clone the repository:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;hg clone http://bitbucket.org/sjl/hg-paste/
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Edit the &lt;code&gt;[extensions]&lt;/code&gt; section in your &lt;code&gt;~/.hgrc&lt;/code&gt; file:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[extensions]
paste = (path to)/hg-paste/paste.py
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Using the Command&lt;/h2&gt;
&lt;p&gt;To paste a diff of all uncommitted changes in the working directory:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;hg paste
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To paste the changes that revision &lt;code&gt;REV&lt;/code&gt; made:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;hg paste -r REV
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To paste the changes between revisions &lt;code&gt;REV1&lt;/code&gt; and &lt;code&gt;REV2&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;hg paste -r REV1:REV2
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If any files are specified only those files will be included in the diffs.&lt;/p&gt;
&lt;p&gt;Several options can be used to specify more metadata about the paste:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;hg paste --user Steve --title 'Progress on feature X' --keep
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The pastebin website to use can be specified with &lt;code&gt;--dest&lt;/code&gt;.  Currently
only &lt;a href="http://dpaste.com/"&gt;dpaste.com&lt;/a&gt; and &lt;a href="http://dpaste.org"&gt;dpaste.org&lt;/a&gt; are supported.&lt;/p&gt;
&lt;h2&gt;Questions, Comments, Suggestions&lt;/h2&gt;
&lt;p&gt;If you find any bugs, please create an issue in the &lt;a href="http://bitbucket.org/sjl/hg-paste/issues/?status=new&amp;amp;status=open"&gt;issue tracker&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If you want to contribute (support for more pastebin websites would be great), fork the &lt;a href="http://bitbucket.org/sjl/hg-paste"&gt;repository&lt;/a&gt; on BitBucket and send a pull request.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/stevelosh/~4/gpt052osOqM" height="1" width="1"/&gt;</description><author>steve@stevelosh.com (Steve Losh)</author><pubDate>Wed, 16 Sep 2009 17:52:55 -0500</pubDate><guid isPermaLink="false">http://stevelosh.com/projects/hg-paste/</guid><feedburner:origLink>http://stevelosh.com/projects/hg-paste/</feedburner:origLink></item><item><title>grabtweets</title><link>http://feedproxy.google.com/~r/stevelosh/~3/Oxz6YHXNee0/</link><description>&lt;p&gt;&lt;code&gt;grabtweets&lt;/code&gt; is a simple tool to backup your tweets.&lt;/p&gt;
&lt;p&gt;The code is in a &lt;a href="http://bitbucket.org/sjl/grabtweets/"&gt;Mercurial repository&lt;/a&gt; on &lt;a href="http://bitbucket.org/"&gt;BitBucket&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;[TOC]&lt;/p&gt;
&lt;h2&gt;Installing&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;grabtweets&lt;/code&gt; requires &lt;a href="http://python.org/"&gt;Python&lt;/a&gt; 2.6 or later.&lt;/p&gt;
&lt;p&gt;To install it, you can &lt;a href="http://bitbucket.org/sjl/grabtweets/get/tip.zip"&gt;download&lt;/a&gt; the latest version, or clone the Mercurial repository:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;hg clone http://bitbucket.org/sjl/grabtweets/
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can put it anywhere you like.&lt;/p&gt;
&lt;h2&gt;Using&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;grabtweets&lt;/code&gt; can back up your tweets and print tweets that it has already archived.&lt;/p&gt;
&lt;h3&gt;Backing Up Tweets&lt;/h3&gt;
&lt;p&gt;To back up your tweets, run &lt;code&gt;grabtweets&lt;/code&gt; like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ grabtweets.py -u USERNAME FILE
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;grabtweets&lt;/code&gt; will pull down the 200 newest tweets from USERNAME and store them in FILE.&lt;/p&gt;
&lt;p&gt;You probably have more than 200 tweets.  However, Twitter will only let you pull down 200 at a time and hitting the server too fast will result in Twitter cutting off your access for a while.&lt;/p&gt;
&lt;p&gt;To deal with this, it's best to set up &lt;code&gt;grabtweets&lt;/code&gt; as a cron/launchd job that runs every couple of hours.  Each time it runs, it will pull down the newest 200 tweets, plus 200 older tweets if there are any available.&lt;/p&gt;
&lt;p&gt;It will take about &lt;code&gt;NUMBER_OF_TWEETS_YOU_HAVE/200&lt;/code&gt; runs to finish archiving your tweets.  Just set it up and forget about it.&lt;/p&gt;
&lt;h3&gt;Printing Backed Up Tweets&lt;/h3&gt;
&lt;p&gt;To print the tweets that &lt;code&gt;grabtweets&lt;/code&gt; has already backed up, run it like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ grabtweets.py -p FILE
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Problems, Contributing, etc&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;grabtweets&lt;/code&gt; was hacked together in an hour.  There are probably bugs.  If you find any, go ahead and create an issue in the &lt;a href="http://bitbucket.org/sjl/grabtweets/issues/?status=new&amp;amp;status=open"&gt;issue tracker&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Want to fix something or add a feature?  Great!  Fork the &lt;a href="http://bitbucket.org/sjl/grabtweets/"&gt;repository&lt;/a&gt; and send me a pull request.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/stevelosh/~4/Oxz6YHXNee0" height="1" width="1"/&gt;</description><author>steve@stevelosh.com (Steve Losh)</author><pubDate>Sat, 12 Sep 2009 11:02:46 -0500</pubDate><guid isPermaLink="false">http://stevelosh.com/projects/grabtweets/</guid><feedburner:origLink>http://stevelosh.com/projects/grabtweets/</feedburner:origLink></item><item><title>t</title><link>http://feedproxy.google.com/~r/stevelosh/~3/Zs5rYUom0ic/</link><description>&lt;p&gt;&lt;code&gt;t&lt;/code&gt; is a command-line todo list manager for people that want to &lt;em&gt;finish&lt;/em&gt; tasks, not organize them.&lt;/p&gt;
&lt;p&gt;The code is in a &lt;a href="http://bitbucket.org/sjl/t/"&gt;Mercurial repository&lt;/a&gt; on &lt;a href="http://bitbucket.org/"&gt;BitBucket&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;[TOC]&lt;/p&gt;
&lt;h2&gt;Why t?&lt;/h2&gt;
&lt;p&gt;Yeah, I know, &lt;em&gt;another&lt;/em&gt; command-line todo list manager.  Several others already exist (&lt;a href="http://ginatrapani.github.com/todo.txt-cli/"&gt;todo.txt&lt;/a&gt; and &lt;a href="http://taskwarrior.org/projects/show/taskwarrior/"&gt;TaskWarrior&lt;/a&gt; come to mind), so why make another one?&lt;/p&gt;
&lt;h3&gt;It Does the Simplest Thing That Could Possibly Work&lt;/h3&gt;
&lt;p&gt;Todo.txt and TaskWarrior are feature-packed.  They let you tag tasks, split them into projects, set priorities, order them, color-code them, and much more.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;That's the problem.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;It's easy to say "I'll just organize my todo list a bit" and spend 15 minutes tagging your tasks.  In those 15 minutes you probably could have &lt;em&gt;finished&lt;/em&gt; a couple of them.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;t&lt;/code&gt; was inspired by &lt;a href="http://github.com/rupa/j2/"&gt;j&lt;/a&gt;.  It's simple, messy, has almost no features, and is extremely effective at the one thing it does.  With &lt;code&gt;t&lt;/code&gt; the only way to make your todo list prettier is to &lt;strong&gt;finish some damn tasks&lt;/strong&gt;.&lt;/p&gt;
&lt;h3&gt;It's Flexible&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;t&lt;/code&gt;'s simplicity makes it extremely flexible.&lt;/p&gt;
&lt;p&gt;Want to edit a bunch of tasks at once?  Open the list in a text editor.&lt;/p&gt;
&lt;p&gt;Want to view the lists on a computer that doesn't have &lt;code&gt;t&lt;/code&gt; installed?  Open the list in a text editor.&lt;/p&gt;
&lt;p&gt;Want to synchronize the list across a couple of computers?  Keep your task lists in a &lt;a href="https://www.getdropbox.com/"&gt;Dropbox&lt;/a&gt; folder.&lt;/p&gt;
&lt;p&gt;Want to use it as a distributed bug tracking system like &lt;a href="http://bugseverywhere.org/"&gt;BugsEverywhere&lt;/a&gt;?  Make the task list a &lt;code&gt;bugs&lt;/code&gt; file in the project repository.&lt;/p&gt;
&lt;h3&gt;It Plays Nice with Version Control&lt;/h3&gt;
&lt;p&gt;Other systems keep your tasks in a plain text file.  This is a good thing, and &lt;code&gt;t&lt;/code&gt; follows their lead.&lt;/p&gt;
&lt;p&gt;However, some of them append new tasks to the end of the file when you create them.  This is not good if you're using a version control system to let more than one person edit a todo list.  If two people add a task and then try to merge, they'll get a conflict and have to resolve it manually.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;t&lt;/code&gt; uses random IDs (actually SHA1 hashes) to order the todo list files.  Once the list has a couple of tasks in it, adding more is far less likely to cause a merge conflict because the list is sorted.&lt;/p&gt;
&lt;h2&gt;Installing t&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;t&lt;/code&gt; requires &lt;a href="http://python.org/"&gt;Python&lt;/a&gt; 2.5 or newer, and some form of UNIX-like shell (bash works well).  It works on Linux, OS X, and Windows (with &lt;a href="http://www.cygwin.com/"&gt;Cygwin&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;Installing and setting up &lt;code&gt;t&lt;/code&gt; will take about one minute.&lt;/p&gt;
&lt;p&gt;First, &lt;a href="http://bitbucket.org/sjl/t/get/tip.zip"&gt;download&lt;/a&gt; the newest version or clone the Mercurial repository ( &lt;code&gt;hg clone http://bitbucket.org/sjl/t/&lt;/code&gt; ).  Put it anywhere you like.&lt;/p&gt;
&lt;p&gt;Next, decide where you want to keep your todo lists.  I put mine in &lt;code&gt;~/tasks&lt;/code&gt;.  Create that directory:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;mkdir ~/tasks
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Finally, set up an alias to run &lt;code&gt;t&lt;/code&gt;.  Put something like this in your &lt;code&gt;~/.bashrc&lt;/code&gt; file:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;alias t='python ~/path/to/t.py --task-dir ~/tasks --list tasks'
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Make sure you run &lt;code&gt;source ~/.bashrc&lt;/code&gt; or restart your terminal window to make the alias take effect.&lt;/p&gt;
&lt;h2&gt;Using t&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;t&lt;/code&gt; is quick and easy to use.&lt;/p&gt;
&lt;h3&gt;Add a Task&lt;/h3&gt;
&lt;p&gt;To add a task, use &lt;code&gt;t [task description]&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ t Clean the apartment.
$ t Write chapter 10 of the novel.
$ t Buy more beer.
$
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;List Your Tasks&lt;/h3&gt;
&lt;p&gt;Listing your tasks is even easier -- just use &lt;code&gt;t&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ t
9  - Buy more beer.
30 - Clean the apartment.
31 - Write chapter 10 of the novel.
$
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;t&lt;/code&gt; will list all of your unfinished tasks and their IDs.&lt;/p&gt;
&lt;h3&gt;Finish a Task&lt;/h3&gt;
&lt;p&gt;After you're done with something, use &lt;code&gt;t -f ID&lt;/code&gt; to finish it:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ t -f 31
$ t
9  - Buy more beer.
30 - Clean the apartment.
$
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Edit a Task&lt;/h3&gt;
&lt;p&gt;Sometimes you might want to change the wording of a task.  You can use &lt;code&gt;t -e ID [new description]&lt;/code&gt; to do that:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ t -e 30 Clean the entire apartment.
$ t
9  - Buy more beer.
30 - Clean the entire apartment.
$
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Yes, nerds, you can use sed-style substitution strings:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ t -e 9 /more/a lot more/
$ t
9  - Buy a lot more beer.
30 - Clean the entire apartment.
$
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Tips and Tricks&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;t&lt;/code&gt; might be simple, but it can do a lot of interesting things.&lt;/p&gt;
&lt;h3&gt;Count Your Tasks&lt;/h3&gt;
&lt;p&gt;Counting your tasks is simple using the &lt;code&gt;wc&lt;/code&gt; program:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ t | wc -l
      2
$
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Put Your Task Count in Your Bash Prompt&lt;/h3&gt;
&lt;p&gt;Want a count of your tasks right in your prompt?  Edit your &lt;code&gt;~/.bashrc&lt;/code&gt; file:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;export PS1="[$(t | wc -l | sed -e's/ *//')] $PS1"
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now you've got a prompt that looks something like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[2] $ t -f 30
[1] $ t Feed the cat.
[2] $
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Multiple Lists&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;t&lt;/code&gt; is for people that want to &lt;em&gt;do&lt;/em&gt; tasks, not organize them.  With that said, sometimes it's useful to be able to have at least &lt;em&gt;one&lt;/em&gt; level of organization.  To split up your tasks into different lists you can add a few more aliases:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;alias g='python ~/path/to/t.py --task-dir ~/tasks --list groceries'
alias m='python ~/path/to/t.py --task-dir ~/tasks --list music-to-buy'
alias w='python ~/path/to/t.py --task-dir ~/tasks --list wines-to-try'
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Distributed Bugtracking&lt;/h3&gt;
&lt;p&gt;Like the idea of distributed bug trackers like &lt;a href="http://bugseverywhere.org/"&gt;BugsEverywhere&lt;/a&gt;, but don't want to use such a heavyweight system?  You can use &lt;code&gt;t&lt;/code&gt; instead.&lt;/p&gt;
&lt;p&gt;Add another alias to your &lt;code&gt;~/.bashrc&lt;/code&gt; file:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;alias b='python ~/path/to/t.py --task-dir . --list bugs'
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now when you're in your project directory you can use &lt;code&gt;b&lt;/code&gt; to manage the list of bugs/tasks for that project.  Add the &lt;code&gt;bugs&lt;/code&gt; file to version control and you're all set.&lt;/p&gt;
&lt;p&gt;Even people without &lt;code&gt;t&lt;/code&gt; installed can view the bug list, because it's plain text.&lt;/p&gt;
&lt;h2&gt;Problems, Contributions, Etc&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;t&lt;/code&gt; was hacked together in a couple of nights to fit my needs.  If you use it and find a bug, please let me know.&lt;/p&gt;
&lt;p&gt;If you want to request a feature feel free, but remember that &lt;code&gt;t&lt;/code&gt; is meant to be simple.  If you need anything beyond the basics you might want to look at &lt;a href="http://ginatrapani.github.com/todo.txt-cli/"&gt;todo.txt&lt;/a&gt; or &lt;a href="http://taskwarrior.org/projects/show/taskwarrior/"&gt;TaskWarrior&lt;/a&gt; instead.  They're great tools with lots of bells and whistles.&lt;/p&gt;
&lt;p&gt;If you want to contribute code to &lt;code&gt;t&lt;/code&gt;, that's great!  Fork the &lt;a href="http://bitbucket.org/sjl/t/"&gt;Mercurial repository&lt;/a&gt; on BitBucket or the &lt;a href="http://github.com/sjl/t/"&gt;git mirror&lt;/a&gt; on GitHub and send me a pull request.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/stevelosh/~4/Zs5rYUom0ic" height="1" width="1"/&gt;</description><author>steve@stevelosh.com (Steve Losh)</author><pubDate>Fri, 11 Sep 2009 19:03:29 -0500</pubDate><guid isPermaLink="false">http://stevelosh.com/projects/t/</guid><feedburner:origLink>http://stevelosh.com/projects/t/</feedburner:origLink></item><item><title>A Guide to Branching in Mercurial</title><link>http://feedproxy.google.com/~r/stevelosh/~3/MNnA0S7SJMM/</link><description>&lt;div class="no-img-borders"&gt;

&lt;p&gt;I've been hanging out in the &lt;a href="irc://irc.freenode.net/#mercurial"&gt;#mercurial&lt;/a&gt; and &lt;a href="irc://irc.freenode.net/#bitbucket"&gt;#bitbucket&lt;/a&gt; channels on freenode a lot lately, and I've noticed a topic that comes up a lot is "how does &lt;a href="http://mercurial.selenic.com/"&gt;Mercurial&lt;/a&gt;'s branching differ from &lt;a href="http://git-scm.com/"&gt;git&lt;/a&gt;'s branching?"&lt;/p&gt;
&lt;p&gt;A while ago &lt;a href="http://litanyagainstfear.com/"&gt;Nick Quaranto&lt;/a&gt; and I were talking about Mercurial and git's branching models on Twitter and I wrote out a &lt;a href="http://a.longreply.com/178502"&gt;quick longreply&lt;/a&gt; about the main differences.  Since then I've pointed some git users toward that post and they seemed to like it, so I figured I'd turn it into something a bit more detailed.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Disclaimer:&lt;/strong&gt; this post is not intended to be a guide to the commands used for working with Mercurial.  It is only meant to be a guide to the &lt;em&gt;concepts&lt;/em&gt; behind the branching models.  For more information on daily use and commands, the &lt;a href="http://hgbook.red-bean.com/"&gt;hg book&lt;/a&gt; is a great resource (if you find it useful, please &lt;a href="http://search.barnesandnoble.com/Mercurial/Bryan-OSullivan/e/9780596800673/?itm=1"&gt;buy&lt;/a&gt; a paper copy to support Bryan and have a printed copy of the &lt;a href="http://twitpic.com/cwod4"&gt;best editing fail of all time&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;[TOC]&lt;/p&gt;
&lt;h2&gt;Prologue&lt;/h2&gt;
&lt;p&gt;Before I start explaining the different branching models, here's a simple repository I'll use as an example:&lt;/p&gt;
&lt;p&gt;&lt;img alt="Basic Repository Diagram" src="/site-media/storage/blog/2009-08-30-branching/branch-base.png" title="Basic Repository" /&gt;&lt;/p&gt;
&lt;p&gt;The repository is in the &lt;code&gt;~/src/test-project&lt;/code&gt; folder.  It has three changesets in it: numbers 0, 1 and 2.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;For git users:&lt;/strong&gt; each changeset in a Mercurial repository has a hash as an identifier, just like with git. However, Mercurial also assigns numbers to each changeset in a repository.  The numbers are &lt;em&gt;only&lt;/em&gt; for that local repository -- two clones might have different numbers assigned to different changesets depending on the order of pulls/pushes/etc.  They're just there for convenience while you're working with a repository.&lt;/p&gt;
&lt;p&gt;The default branch name in Mercurial is "default".  Don't worry about what that means for now, we'll get to it.  I'm mentioning it because there's a little &lt;code&gt;default&lt;/code&gt; marker in the diagram.&lt;/p&gt;
&lt;p&gt;In all of these diagrams, a marker like that with a dashed border doesn't actually exist as an object anywhere.  Those are special names that you can use to identify a changeset instead of the hash or number -- Mercurial will calculate the revision on the fly.&lt;/p&gt;
&lt;p&gt;For now, ignore the &lt;code&gt;default&lt;/code&gt; marker.  I've colored it grey in each of the diagrams where it doesn't matter.&lt;/p&gt;
&lt;h2&gt;Branching with Clones&lt;/h2&gt;
&lt;p&gt;The slowest, safest way to create a branch with Mercurial is to make a new clone of the repository:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ cd ~/src
$ hg clone test-project test-project-feature-branch
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now you've got two copies of the repository.  You can commit separately in each one and push/pull changesets between them as often as you like.  Once you've made some changes in each one, the result might look like this:&lt;/p&gt;
&lt;p&gt;&lt;img alt="Clone Diagram" src="/site-media/storage/blog/2009-08-30-branching/branch-clone.png" title="Branching with Clones" /&gt;&lt;/p&gt;
&lt;p&gt;We've got two copies of the repository.  Both contain the changesets that existed at the time we branched/cloned.  If we push from &lt;code&gt;test-project&lt;/code&gt; into &lt;code&gt;test-project-feature-branch&lt;/code&gt; the "Fix a critical bug" changeset will be pushed over.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;For git users:&lt;/strong&gt; Remember how I mentioned that the changeset numbers are local to a repository?  We can see this clearly here -- there are two different changesets with the number 3.  The numbers are &lt;em&gt;only&lt;/em&gt; used while working inside a single repository.  For pushing, pulling, or talking to other people you should use the hashes.&lt;/p&gt;
&lt;h3&gt;Advantages&lt;/h3&gt;
&lt;p&gt;Cloning is a very safe way of creating a branch.  The two repositories are completely isolated until you push or pull, so there's no danger of breaking anything in one branch when you're working in another.&lt;/p&gt;
&lt;p&gt;Discarding a branch you don't want any more is &lt;em&gt;very&lt;/em&gt; easy with cloned branches.  It's as simple as &lt;code&gt;rm -rf test-project-feature-branch&lt;/code&gt;.  There's no need to mess around with editing repository history, you just delete the damn thing.&lt;/p&gt;
&lt;h3&gt;Disadvantages&lt;/h3&gt;
&lt;p&gt;Creating a branch by cloning locally is slower than the other methods, though Mercurial will use hardlinks when cloning if your OS supports them (most do) so it won't be &lt;em&gt;too&lt;/em&gt; slow.&lt;/p&gt;
&lt;p&gt;However, the clone branching method can really slow things down when other developers (not located nearby) want to work on the project.  If you publish two branches as separate repositories (such as &lt;code&gt;stable&lt;/code&gt; and &lt;code&gt;version-2&lt;/code&gt;), contributors will have to clone down &lt;em&gt;both&lt;/em&gt; repositories through the internet if they want to work on both branches.  That can take a lot of extra time, depending on the repository size and bandwidth.&lt;/p&gt;
&lt;p&gt;It can become especially wasteful if, for example, there are 10,000 changesets before the branch point and maybe 100 per branch after.  Instead of pulling down 10,200 changesets you need to pull down 20,200.  If you want to work on three different branches, you're pulling down 30,300 instead of 10,300.&lt;/p&gt;
&lt;p&gt;There is a way to avoid this large download cost, as pointed out by Guido Ostkamp and timeless_mbp in &lt;a href="irc://irc.freenode.net/#mercurial"&gt;#mercurial&lt;/a&gt;.  The idea is that you clone one branch down from the server, then pull &lt;em&gt;all&lt;/em&gt; the branches into it, then clone locally to split that repository back into branches.  This avoids the cost of cloning down the same changesets over and over.&lt;/p&gt;
&lt;p&gt;An example of this method with three branches would look something like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ hg clone http://server/project-main project
$ cd project
$ hg pull http://server/project-branch1
$ hg pull http://server/project-branch2
$ cd ..
$ hg clone project project-main --rev [head of mainline branch]
$ hg clone project project-branch1 --rev [head of branch1]
$ hg clone project project-branch2 --rev [head of branch2]
$ rm -rf project
$ cd project-main
$ [edit .hg/hgrc file to make the default path http://server/project-main]
$ cd ../project-branch1
$ [edit .hg/hgrc to make the default path http://server/project-branch1]
$ cd ../project-branch2
$ [edit .hg/hgrc to make the default path http://server/project-branch2]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This example assumes you know the IDs of the branch heads off the top of your head, which you probably don't.  You'll have to look them up.&lt;/p&gt;
&lt;p&gt;It also assumes that there is only one new head per branch, when there might be more.  If &lt;code&gt;branch1&lt;/code&gt; has two heads which are not in &lt;code&gt;mainline&lt;/code&gt;, you would need to look up the IDs of &lt;em&gt;both&lt;/em&gt; and specify both in the clone command.&lt;/p&gt;
&lt;p&gt;Another annoyance shows up when you're working on a project that relies on your code being at a specific file path.  If you branch by cloning you'll need to rename directories (or change the file path configuration) every time you want to switch branches.  This might not be a common situation (most build tools don't care about the absolute path to the code) but it &lt;em&gt;does&lt;/em&gt; appear now and then.&lt;/p&gt;
&lt;p&gt;I personally don't like this method and don't use it.  Others do though, so it's good to understand it (Mercurial itself uses this model).&lt;/p&gt;
&lt;h3&gt;Comparison to git&lt;/h3&gt;
&lt;p&gt;Git can use this method of branching too, although I don't see it very often.  Technically this is the exact same thing as creating a fork on &lt;a href="http://github.com/"&gt;GitHub&lt;/a&gt;, but most people think of "fork" and "branch" as separate concepts.&lt;/p&gt;
&lt;h2&gt;Branching with Bookmarks&lt;/h2&gt;
&lt;p&gt;The next way to branch is to use a bookmark.  For example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ cd ~/src/test-project
$ hg bookmark main
$ hg bookmark feature
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now you've got two bookmarks (essentially a tag) for your two branches at the current changeset.&lt;/p&gt;
&lt;p&gt;To switch to one of these branches you can use &lt;code&gt;hg update feature&lt;/code&gt; to update to the tip changeset of that branch and mark yourself as working on that branch.  When you commit, it will move the bookmark to the newly created changeset.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; for more detailed information on actually using bookmarks day-to-day please read the &lt;a href="http://mercurial.selenic.com/wiki/BookmarksExtension"&gt;bookmarks page&lt;/a&gt;.  This guide is meant to show the different branching models, and bookmarks have a few quirks that you should know about if you're going to use them.&lt;/p&gt;
&lt;p&gt;Here's what the repository would look like with this method:&lt;/p&gt;
&lt;p&gt;&lt;img alt="Bookmark Diagram" src="/site-media/storage/blog/2009-08-30-branching/branch-bookmark.png" title="Branching with Bookmarks" /&gt;&lt;/p&gt;
&lt;p&gt;The diagram of the changesets is pretty simple: the branch point was at changeset 2 and each branch has one new changeset on it.&lt;/p&gt;
&lt;p&gt;Now let's look at the markers.  The &lt;code&gt;default&lt;/code&gt; marker is still there, and we're still going to ignore it.&lt;/p&gt;
&lt;p&gt;There are two new labels in this diagram -- these represent the bookmarks.  Notice how their outlines are &lt;em&gt;not&lt;/em&gt; dashed?  This is because bookmarks are actual objects stored on disk, not just convenient shortcuts that Mercurial will let you use.&lt;/p&gt;
&lt;p&gt;When you use a bookmark name as a revision Mercurial will look up the revision it points at and use that.&lt;/p&gt;
&lt;h3&gt;Advantages&lt;/h3&gt;
&lt;p&gt;Bookmarks give you a quick, lightweight way to give meaningful label your branches.&lt;/p&gt;
&lt;p&gt;You can delete them when you no longer need them.  For example, if we finish development of the new feature and merge the changes in the main branch, we probably don't need to keep the &lt;code&gt;feature&lt;/code&gt; bookmark around any more.&lt;/p&gt;
&lt;h3&gt;Disadvantages&lt;/h3&gt;
&lt;p&gt;Being lightweight can also be a disadvantage.  If you delete a bookmark, then look at your code a year later and wonder what all those changesets that got merged into main were for, the bookmark name is gone.  This probably isn't a big issue if you write good changeset summaries.&lt;/p&gt;
&lt;p&gt;Bookmarks are local.  They do &lt;em&gt;not&lt;/em&gt; get transferred during a push or pull!  There has been some whispering about adding this is Mercurial 1.4, but for now if you want to give someone else your bookmarks you'll need to manually give them the file the bookmarks are kept in.&lt;/p&gt;
&lt;h3&gt;Comparison to git&lt;/h3&gt;
&lt;p&gt;Branching with bookmarks is very close to the way git usually handles branching.  Mercurial bookmarks are like git refs: named pointers to changesets that move on commit.&lt;/p&gt;
&lt;p&gt;The biggest difference is that git refs are transferred when pushing/pulling and Mercurial bookmarks are not.&lt;/p&gt;
&lt;h2&gt;Branching with Named Branches&lt;/h2&gt;
&lt;p&gt;The third way of branching is to use Mercurial's named branches. Some people prefer this method (myself included) and many others don't.&lt;/p&gt;
&lt;p&gt;To create a new named branch:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ cd ~/src/test-project
$ hg branch feature
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When you commit the newly created changeset will be on the same branch as its parent, unless you've used &lt;code&gt;hg branch&lt;/code&gt; to mark it as being on a different one.&lt;/p&gt;
&lt;p&gt;Here's what a repository using named branches might look like:&lt;/p&gt;
&lt;p&gt;&lt;img alt="Named Branch Diagram" src="/site-media/storage/blog/2009-08-30-branching/branch-named.png" title="Branching with Named Branches" /&gt;&lt;/p&gt;
&lt;p&gt;An important difference with this method is that the branch name is permanently recorded as part of the changeset's metadata (as you can see in changeset 4 in the diagram).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The default branch is called &lt;code&gt;default&lt;/code&gt; and is not normally shown unless you ask for verbose output.&lt;/p&gt;
&lt;p&gt;Now it's time to explain those magic dashed-border labels we've been ignoring.  Using a branch name to specify a revision is shorthand for "the tip changeset of this named branch".  In this example repository:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Running &lt;code&gt;hg update default&lt;/code&gt; would update to changeset 3, which is the tip of the &lt;code&gt;default&lt;/code&gt; branch.&lt;/li&gt;
&lt;li&gt;Running &lt;code&gt;hg update feature&lt;/code&gt; would update to changeset 4, which is the tip of the &lt;code&gt;feature&lt;/code&gt; branch.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Neither of these labels actually exist as an object anywhere on disk (like a bookmark would).  When you use them Mercurial calculates the appropriate revision on the fly.&lt;/p&gt;
&lt;h3&gt;Advantages&lt;/h3&gt;
&lt;p&gt;The biggest advantage to using named branches is that every changeset on a branch has the branch name as part of its metadata, which I find very helpful (especially when using &lt;a href="http://mercurial.selenic.com/wiki/GraphlogExtension"&gt;graphlog&lt;/a&gt;).&lt;/p&gt;
&lt;h3&gt;Disadvantages&lt;/h3&gt;
&lt;p&gt;Many people don't like cluttering up changeset metadata with branch names, especially if they're small branches that are going to be merged pretty quickly.&lt;/p&gt;
&lt;p&gt;In the past there was also the problem of not having a way to "close" a branch, which means that over time the list of branches could get huge.  This was fixed in Mercurial 1.2 which introduced the &lt;code&gt;--close-branch&lt;/code&gt; option for &lt;code&gt;hg commit&lt;/code&gt;.&lt;/p&gt;
&lt;h3&gt;Comparison to git&lt;/h3&gt;
&lt;p&gt;As far as I know git has no equivalent to Mercurial's named branches.  Branch information is never stored as part of a git changeset's metadata.&lt;/p&gt;
&lt;h2&gt;Branching Anonymously&lt;/h2&gt;
&lt;p&gt;The last method of branching with Mercurial is the fastest and easiest: update to any revision you want and commit. You don't have to think up a name for it or do anything else -- just update and commit.&lt;/p&gt;
&lt;p&gt;When you update to a specific revision, Mercurial will mark the parent of the working directory as that changeset.  When you commit, the newly created changeset's parent will be the parent of the working directory.&lt;/p&gt;
&lt;p&gt;The result of updating and committing without doing anything else would be:&lt;/p&gt;
&lt;p&gt;&lt;img alt="Anonymous Diagram" src="/site-media/storage/blog/2009-08-30-branching/branch-anon.png" title="Branching Anonymously" /&gt;&lt;/p&gt;
&lt;p&gt;How do you switch back and forth between branches once you do this?  Just use   &lt;code&gt;hg update --check REV&lt;/code&gt; with the revision number (or hash) (you can shorten &lt;code&gt;--check&lt;/code&gt; to &lt;code&gt;-c&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; the &lt;code&gt;--check&lt;/code&gt; option was added in Mercurial 1.3, but it was broken.  It's fixed in 1.3.1.  If you're using something earlier than 1.3.1, you really should update.&lt;/p&gt;
&lt;p&gt;Logging commands like &lt;code&gt;hg log&lt;/code&gt; and &lt;code&gt;hg graphlog&lt;/code&gt; will show you all the changesets in the repository, so there's no danger of "losing" changesets.&lt;/p&gt;
&lt;h3&gt;Advantages&lt;/h3&gt;
&lt;p&gt;This is the fastest, easiest way to branch.  You don't have to think of a name or close/delete anything when you're finished -- just update and commit.&lt;/p&gt;
&lt;p&gt;This method is &lt;em&gt;great&lt;/em&gt; for quick-fix, two-or-three-changeset branches.&lt;/p&gt;
&lt;h3&gt;Disadvantages&lt;/h3&gt;
&lt;p&gt;Using anonymous branching obviously means that there won't be any descriptive name for a branch, so you'll need to write good commit messages if you want to remember what a branch was for a couple of months later.&lt;/p&gt;
&lt;p&gt;Not having a single name to represent a branch means that you'll need to look up the revision numbers or hashes with &lt;code&gt;hg log&lt;/code&gt; or &lt;code&gt;hg graphlog&lt;/code&gt; each time you want to switch back and forth.  If you're switching a lot this might be more trouble than it's worth.&lt;/p&gt;
&lt;h3&gt;Comparison to git&lt;/h3&gt;
&lt;p&gt;Git has no real way to handle this.  Sure, it lets you update and commit, but if you don't create a (named) ref to that new commit you're never going to find it again once you switch to another one.  Well, unless you feel like grep'ing through a bunch of log output.&lt;/p&gt;
&lt;p&gt;Oh, and hopefully it doesn't get garbage collected.&lt;/p&gt;
&lt;p&gt;Sometimes you might not want to think up a name for a quick-fix branch. With git you &lt;em&gt;have&lt;/em&gt; to name it if you want to really do anything with it, with Mercurial you don't.&lt;/p&gt;
&lt;h2&gt;One More Difference Between Mercurial and git&lt;/h2&gt;
&lt;p&gt;There's one more &lt;em&gt;big&lt;/em&gt; difference between Mercurial's branching and git's branching:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Mercurial will push/pull &lt;em&gt;all&lt;/em&gt; branches by default, while git will push/pull only the &lt;em&gt;current&lt;/em&gt; branch.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This is important if you're a git user working with Mercurial.  If you want to push/pull only a single branch with Mercurial you can use the &lt;code&gt;--rev&lt;/code&gt; option (&lt;code&gt;-r&lt;/code&gt; for short) and specify the tip revision of the branch:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ hg push --rev branchname
$ hg push --rev bookmarkname
$ hg push --rev 4
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you specify a revision, Mercurial will push that changeset and any ancestors of it that the target doesn't already have.&lt;/p&gt;
&lt;p&gt;This doesn't apply when you use the "Branching with Clones" method because the branches are separate repositories.&lt;/p&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;I hope this guide is helpful.  If you see anything I've missed, especially on the git side of things (I don't use git any more than I have to) or have any questions please let me know!&lt;/p&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/stevelosh/~4/MNnA0S7SJMM" height="1" width="1"/&gt;</description><author>steve@stevelosh.com (Steve Losh)</author><pubDate>Sun, 30 Aug 2009 20:27:12 -0500</pubDate><guid isPermaLink="false">http://stevelosh.com/blog/entry/2009/8/30/a-guide-to-branching-in-mercurial/</guid><feedburner:origLink>http://stevelosh.com/blog/entry/2009/8/30/a-guide-to-branching-in-mercurial/</feedburner:origLink></item><item><title>Women in Water</title><link>http://feedproxy.google.com/~r/stevelosh/~3/MXE6pDTA5fs/</link><description>&lt;div class="gallery"&gt;
    &lt;img src="/site-media/storage/projects/2009-08-04-women-in-water/erin-tele.jpg" /&gt;
    &lt;img src="/site-media/storage/projects/2009-08-04-women-in-water/alex-tele.jpg" /&gt;
    &lt;img src="/site-media/storage/projects/2009-08-04-women-in-water/lizza-tele.jpg" /&gt;
    &lt;img src="/site-media/storage/projects/2009-08-04-women-in-water/leah-tele.jpg" /&gt;
    &lt;img src="/site-media/storage/projects/2009-08-04-women-in-water/anna-tele.jpg" /&gt;
    &lt;img src="/site-media/storage/projects/2009-08-04-women-in-water/erin-wide.jpg" /&gt;
    &lt;img src="/site-media/storage/projects/2009-08-04-women-in-water/alex-wide.jpg" /&gt;
    &lt;img src="/site-media/storage/projects/2009-08-04-women-in-water/lizza-wide.jpg" /&gt;
    &lt;img src="/site-media/storage/projects/2009-08-04-women-in-water/leah-wide.jpg" /&gt;
    &lt;img src="/site-media/storage/projects/2009-08-04-women-in-water/anna-wide.jpg" /&gt;
&lt;/div&gt;

&lt;p&gt;This is still a work in progress.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/stevelosh/~4/MXE6pDTA5fs" height="1" width="1"/&gt;</description><author>steve@stevelosh.com (Steve Losh)</author><pubDate>Tue, 04 Aug 2009 18:57:36 -0500</pubDate><guid isPermaLink="false">http://stevelosh.com/projects/women-in-water/</guid><feedburner:origLink>http://stevelosh.com/projects/women-in-water/</feedburner:origLink></item></channel></rss>
