Search code examples
mercurial

How to create new head on commit?


I'm working on my thesis and storing changes in mercurial. I'm not getting an error that I've got multiple heads, which I'm confused about -- I've only got one working repository which I push occasionally to bitbucket. Here's what happened:

$ hg commit -m "Fixing up..."
abort: No such file or directory: /Users/me/Dropbox/thesis/thesis_tex/simple.pdf
$ hg commit -m "Adding in page headers"
created new head

...one more commit, not having realized that having created a new head was a problem...

$ hg push
pushing to ssh://hg@bitbucket.org/...
searching for changes
abort: push creates new remote heads!
(did you forget to merge? use push -f to force)

$ hg heads
changeset:   26:3823a395b1ce
tag:         tip
user:        me
date:        Fri Aug 26 09:39:45 2011 -0400
summary:     Adding...

changeset:   24:c7c6517d4281
user:        me
date:        Thu Aug 25 16:34:42 2011 -0400
summary:     Fixing up...

How can I easily get rid of the other head, without messing up my working directory? Why did a second head get created? Is there a problem with keeping mercurial repositories in dropbox folders?


Solution

  • How can I easily get rid of the other head, without messing up my working directory?

    Merge the branches with hg merge.

    Is there a problem with keeping mercurial repositories in dropbox folders?

    This seems redundant to me, since Dropbox keeps a 30-day history on your files. I'd choose either Hg+Bitbucket (or whatever Mercurial hosting) or Dropbox, but not both.


    Edit: Why not use Mercurial and Dropbox? Here's why.

    Ben Hughes said it well:

    By keeping your Mercurial repo on Dropbox you’re version controlling your version control system files. If you somehow manage to cause a conflict with files in your .hg directory, things could get messy. Recoverable, but messy.