Multiple repositories in one directory (same level) - is it possible?

前端 未结 7 639
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-06 08:12

My original problem is that I have a directory where I write various scripts. Each of them is independent of others, and usually one-file-long. I want to have some versioning ap

7条回答
  •  太阳男子
    2021-02-06 08:35

    You can create multiple hidden repository directories and symlink .hg to whichever one you want to be active. So if you have two repositories, create directories for them:

    .hg_production
    .hg_staging
    

    Then to activate either of them just do:

    ln -sf .hg_production .hg
    

    You could easily create a bash command to do this. So instead you could write something like activate-repo production, which would run ln -sf .hg_production .hg.

    Note: Mac doesn't seem to support ln -sf so instead you'll need to do:

    rm .hg; ln -s .hg_production .hg
    

提交回复
热议问题