Can I clone part of a Mercurial repository?

前端 未结 7 1068
余生分开走
余生分开走 2020-12-24 01:27

Is it possible to clone part of a Mercurial repository? Let\'s say the repository is quite large, or contains multiple projects, or multiple branches. Can I clone only part

7条回答
  •  萌比男神i
    2020-12-24 01:34

    @Nick

    "E.g. in Subversion, you might have trunk and branches. If I only want to get trunk (or one of the branches) I can just request [project]/trunk. If I clone the hg repo I'll get trunk and all of the branches. This might be a lot of information I don't want. Can I avoid getting this?"

    Absolutely. Just use hg clone -r and get only the branch you want. If you have lots of branches, you need a -r for each one. doesn't have to be a named branch: you can simply have multiple unnamed heads (or named heads using bookmark, though those still aren't perfect, because currently they don't show up with push/pull/clone).

    Keep in mind that in DVCSes, Mercurial among them, branches are often short-lived and merged back into each other frequently. If you pull a branch you will still get the common history it has with any other branches.

提交回复
热议问题