How to repeatedly merge branches in Mercurial

匿名 (未验证) 提交于 2019-12-03 02:45:02

问题:

We're using Mercurial where I work and I want to have a setup similar to how I used SVN:

  • Trunk
  • Tags
    • Production
  • Branches

Since Mercurial supports branches natively, I know how to create a named branch, but I can't find any documentation on how to repeatedly merge 'Trunk' with 'Production'.

Quite simply, I want to have a development branch for normal work and a production branch that I routinely pull changes from the development branch into. How do I do this with Mercurial?

回答1:

As the previous poster mentioned, the transplant extension can be used for cherry-picking individual changes from one branch to another. If, however, you always want to pull all the latest changes, the hg merge command will get you there.

The simplest case is when you're using clones to implement branching (since that's the use case Mercurial is designed around). Assuming you've turned on the built-in fetch extension in your .hgrc / Mercurial.ini:

cd ~/src/development # hack hack hack hg commit -m "Made some changes" cd ../production hg fetch ../development 

If you're using local branches:

hg update -C development # hack hack hack hg commit -m "Made some changes" hg update -C production hg merge development hg commit -m "Merged from development" 


回答2:

Something like hg transplant? That's what we use on our dev and prod branches.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!