1

我一直在研究一个 Eclipse 插件项目,我遇到了一种情况,我需要拆分项目以将测试用例与插件包分开。我使用 git 作为版本控制。

为了简单地描述这一点,我正在像这样对旧项目进行版本控制:

workspace/
  |
  +-- myplugin/
         |
         +-- .git/ <-- Here be the git repository
         |
         +-- /* Source code, project stuff, etc. */

…而且我处于需要在单独的项目中进行插件测试的情况(这样就不需要将 jUnit 作为插件的必需捆绑包)。而且我希望存储库对工作区中的所有内容进行版本控制。像这样:

workspace/
  |
  +-- .git/ <-- The repository should be relocated here instead…
  |
  +-- myplugin/
  |      |
  |      +-- /* Source code, project stuff, etc. */
  |
  +-- myplugin-test/
         |
         +-- /* Unit tests and stuff… */

有没有一种简单的方法可以在不丢失旧项目历史的情况下做到这一点?

4

1 回答 1

5

这是伪代码的工作流程:

cd 工作区/myplugin
mkdir myplugin
git mv * myplugin # 你可能需要手动对所有文件/文件夹执行此操作
mkdir myplugin-test
# 将文件移动/添加到 myplugin-test
git commit -a -m "重组"
cd 工作区
mv myplugin myplugin_old
mv myplugin_old/* 。
# 你应该得到请求的结构
于 2008-10-24T11:50:57.873 回答