Why did "hg push", push my local bookmark to remote?

Martin Geisler martin at geisler.net
Mon Feb 9 13:05:59 UTC 2015


Jaikiran Pai <jai.forums2013 at gmail.com> writes:

> On Friday 06 February 2015 12:41 PM, Sean Farley wrote:
>>> I however wish that it was much simpler than this and maybe that
>>> proposal in that mercurial-dev thread from 2012 could be revisited to
>>> improve the situation?
>> That is moot as far as I understand. What would be considered now is a
>> proposal to improve the 'paths' option to only push certain branches to
>> specific remote servers.
>>
>> I don't understand what you want to be easier. You are saying that
>> adding *one* command-line option of '-s' to your secret branch is too
>> hard? I find that very explicit and refreshing that Mercurial is doing
>> what I told it to do: mark this secret. Commits on top of secret commits
>> are always secret.
>
> Sean, the thing I wish was easier was local/lightweight branches in
> mercurial. As a developer working on various different features, bug
> fixes locally I wish it's easier to just do a "hg up
> local-branch/bookmark/or-whatever-other-term", then do some commits on
> it and don't have to worry that those commits will end up remotely
> unless I explicitly push them. The "paths" proposal sounds like it
> could take care of this. From what I understand of that proposal, it
> sounds like I would be able to do in hg what I currently can do with
> local lightweight branches in git like:
>
> git checkout local-branch-foo
> ... // do changes
> git commit -m "WIP commit locally"
> git push upstream master // i.e. *don't* push local-branch-foo but
> only push the branch named master to upstream remote repo

This is really the crucial difference. In Git you normally explicitly
say which commits you want to push. You can do that with Mercurial too:

  hg push -r @  // only push the '@' bookmark, don't push other heads

You can always check with 'hg outgoing' what the next 'hg push' will do.

Also, what is meant by bookmarks being local by default is that they
(the bookmark names) are not pushed to remote servers by default.
However, bookmarks came late in the development of Mercurial and as such
the normal rules for what 'hg push' is pushing still applies. In other
words, if 'hg push' would send a commit to the remote server, it will
still do that even if you've put a bookmark on the server.

-- 
Martin Geisler

http://google.com/+MartinGeisler
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20150209/3c081793/attachment.asc>


More information about the Mercurial mailing list