我有一个Mercurial存储库,其中包含300个提交,其中还包含许多相对较大的文件(例如10个以上的MiB)。我想将其转换为Git存储库,保留所有分支和合并,还使用LFS扩展名来管理大文件。到目前为止,这是我的流程:
hg clone <URL>
从服务器上复制Hg存储库git init
在其他地方创建一个新的git repo cd
进入git repo,然后用hg-fast-export -r <hg-repo> -A <authors>
进行转换。至此,我有一个可以正常工作的仓库,但是所有大文件仍然是索引的一部分。我想在其他任何内容之前添加新的提交,以插入.gitignore
和.gitattributes
文件。git checkout --orphan new-root && git rm -rf .
git add * && git commit -m "Check in git metafiles"
git checkout master && git rebase --root --onto new-root --preserve-merges
这就是我遇到的问题。在将此错误转储给我之前,rebase进行了大约10次提交。
error: Your local changes to the following files would be overwritten by merge:
assets/ui/sayscreen/blackarrow.png
assets/ui/sayscreen/blackcircle.png
assets/ui/sayscreen/thoughtbox.png
assets/ui/sayscreen/translationbox.png
assets/ui/sayscreen/whitearrow.png
assets/ui/sayscreen/whitecircle.png
Please commit your changes or stash them before you merge.
Aborting
fatal: cherry-pick failed
Could not pick 01908b624e50709de07685ef8ab158feef02e9e0
真正让我感到困惑的是,在原始的汞库中,目前还没有合并。第一次合并提交的时间是15。此外,运行git status
会列出50-60个修改过的文件,即使该特定的提交最初只涉及8个文件。最后,使用git ls-files -u
来尝试查看哪些文件存在冲突。
由于git status
列出的大多数文件都是PNG图像,所以我首先想到的是LFS在某种程度上妨碍了我们的工作,并试图在重新设置基准期间提取较大的Blob。但是,在开始整个过程之前,我是在全局环境中运行git lfs uninstall
,目的是在对变基操作感到满意之后再进行git lfs migrate import --fixup
。
是什么原因导致这些合并冲突,以及如何解决它才能完成迁移?
答案 0 :(得分:0)
我刚从最近扩展了大文件的商业回购中转换为git。这里有几点。
$hg clone <hg-repo>
$hg -v lfpull --rev "all()"
$cd ..
$hg lfconvert --to-normal <hg-repo> <hg-repo-nolf>
... // verify the repo
$hg-fast-export -r <hg-repo> -A <authors>