如何使用 git filter-repo 拆分一个 git 存储库,同时维护 git 历史和分支,将许多目录分成两个单独的存储库?

问题描述 投票:0回答:0

我有一个这样设置的回购协议(里面还有很多,但这里有一些项目):

MyProject
   |
   --- Frontend/
   |
   --- Frontend Tests/
   |
   --- Another Frontend/
   | 
   --- Backend/
   |
   --- Backend Tests/
   |
   --- .tool-versions
   |
   --- package.json

我想把这个 repo 分成 2 个,前端的东西在一个,后端在另一个。在这两个文件中,我都需要单独的文件,例如 .tool-versions 和 package.json。我一直在尝试遵循以下两个指南: https://edezekiel.medium.com/git-filter-repo-splitting-a-subfolder-into-a-new-repository-e13d40e448e5 https://docs.github.com/en/get-started/using-git/splitting-a-subfolder-out-into-a-new-repository

但是每当我到达使用

git filter-repo
的步骤时,我都会收到这些错误:

Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.
git update-ref failed; see above

但是没有进程在运行,也没有任何更改或提交。另一个错误是:

Aborting: Refusing to destructively overwrite repo history since
this does not look like a fresh clone.
  (you have untracked changes)
Please operate on a fresh clone instead.  If you want to proceed
anyway, use --force.

但这是一个新的克隆。

如果我添加

--force
参数,这会影响我们的远程回购历史吗?

git repository git-filter-repo git-filter
© www.soinside.com 2019 - 2024. All rights reserved.