如何保持较小的Mercurial存储库? [英] How to keep a Mercurial repository small?

查看:78
本文介绍了如何保持较小的Mercurial存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的中央存储库存储在8GB USB记忆棒上.我不小心提交了一些大文件,因此存储库不再适合使用了.有办法纠正这种情况吗?

My central repository is stored on an 8GB USB stick. I accidentally committed some big files, so the repository doesn't fit on the stick anymore. Is there a way to correct this situation?

推荐答案

我赞成catchyifyoutry的答案,因为他已经掌握了您可能会使用的步骤,但这是一个方便的列表.

I voted up catchyifyoutry's answer since he's got the steps you'll probably use, but here's a handy list.

首先,提醒一下.如果您已经将该存储库推送到半公开的某个地方,并且有人将其存储在该存储库中,则以下任何提示均无效.接下来,当他们按下并拉动它们时,您将以未修改的形式返回原始变更集.您唯一的办法是与拥有克隆的每个人交谈,并要求他们删除它并重新克隆.也就是说,在列表上:

First, though, a reminder. If you've already pushed this repository somewhere semi-public, and people have pulled the repository, then none of the tips below will work. When next they push and you pull you'll get the original changesets back in their unmodified form. Your only recourse is to talk to each person who has a clone and ask them to delete it and re-clone. That said, on to the list:

如何清除意外提交的文件

  • 如果您尚未拉出或承诺其他任何操作:hg rollback将作为一级撤消操作
  • 如果您愿意放弃最近的N个修订版:hg clone -r -N repo-with-too-much repo-with-N-fewer changesets#示例:hg clone -r -2 big-repo small-repo
  • 如果您的更改时间太久而使其中任何一个都没问题:hg convert --filemap myfilemap.txt too-big-repo new-repo
  • If you've not yet pulled or committed anything else: hg rollback will act as one level undo
  • If you're willing to throw away the last N revisions: hg clone -r -N repo-with-too-much repo-with-N-fewer changesets # example: hg clone -r -2 big-repo small-repo
  • If your change was too long ago for either of those to be okay: hg convert --filemap myfilemap.txt too-big-repo new-repo

在最后一种情况下,myfilemap.txt包含在其中:

In that last case myfilemap.txt has in it:

exclude path/to/file/to/remove

注意:

  • clone -r案例从技术上要求最小的克隆,其中可能包括修订版tip-N(如果您有分支存储库,则为该版本).额外的pull -r行(每头一个)将是必要的,以克服其他非线性历史记录.
  • 使用hg convert解决方案,将修改每个修改的变更集及其所有后代的哈希码.
  • the clone -r case technically asks for the minimal clone that could include revision tip-N, which if you have a branchy repo. Additionall pull -r lines (one per head) will be necessary to pull over other non-linear history.
  • with the hg convert solution the hashcode of every modified changeset and all of their descendants will be modified.

这篇关于如何保持较小的Mercurial存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆