Is `hg pull --rebase` analogous to `svn update`?

前端 未结 5 2147
情歌与酒
情歌与酒 2021-02-01 05:47

This question assumes there\'s a \"blessed\" central repository that members of a team

  1. clone from
  2. push to when they have contributions that they want othe
5条回答
  •  面向向阳花
    2021-02-01 06:04

    Not exactly.

    hg pull grabs the revisions from the other repository and adds them to the locally available revisions in your clone of the repository, but does not update your working copy - only your repository (which, for DCVS like hg/git/etc is not the same thing as a working copy).

    hg update updates your actual working copy to the latest revision in your local repository.

    This differs from Subversion because in svn, there is no such thing as your "local repository" - the only repository is the one on the server; you only have a working copy locally. Hence why update is only a single command, as opposed to Mercurial's pull and then update.

    The equivalent to svn update for Mercurial would be hg pull --update, which is equivalent to doing hg pull and then hg update one after another.

    An end-to-end workflow for DCVS with a "central" repo looks something like this:

    1. A does hg commit on some changes.
    2. A does hg push to push them the central repository.
    3. B does hg pull to pull them from the central repository into their own clone.
    4. B does hg update to update their working copy to reflect the changes pulled into their clone.

    In systems without a central repo, it would instead look something like this:

    1. A does hg commit on some changes.
    2. B, who has cloned A's repo, wants those changes, and thus does an hg pull directly from A's repo.
    3. B uses hg update to update their working copy to the changes.

    Also, the equivalent to svn revert is hg revert. :)

提交回复
热议问题