Why did "hg push", push my local bookmark to remote?
Sean Farley
sean.michael.farley at gmail.com
Fri Feb 6 05:57:03 UTC 2015
Jaikiran Pai writes:
> I used to be a git user but have been using mercurial in a recent
> project, for a while now. Just recently, I decided to use the "bookmark"
> feature of mercurial to have lightweight branches similar to git. The
> documentation at various places about bookmark suggests that if I have a
> (local) bookmark and commits in that booking and I'm pushing to a remote
> repository, then the commits to the bookmark will *not* be pushed to the
Incorrect. The commits will be pushed depending on the revset you
requested to be pushed (by default all commits are pushed).
Only the bookmark itself will be pushed if the remote server has it.
> remote repository unless the remote repository has that bookmark too.
> That's a good thing and that's what I want. However, that doesn't seem
> to be how it's working (I was on 2.8 version of mercurial but it's the
> same with 3.3 too). Here's what I did:
>
> hg bookmark test-bookmark // create a new bookmark
> hg up test-bookmark // up to that bookmark
> ... update an existing file in the workspace
> hg commit -m "Dummy test commit in bookmark" // commit the local change
> hg push // push to remote
>
> To my surprise, the commit that I did to the bookmark got pushed to the
> remote repo and is now visible/available to everyone and has the
> potential to cause problems (since it was a work in progress change). I
> didn't explicitly push the bookmark, yet it got pushed to remote by a
> plain hg push. Did I miss something about how bookmarks work in mercurial?
You probably want to create an alias called 'nudge':
~/.hgrc:
[alias]
nudge = push -r .
More information about the Mercurial
mailing list