Eclipse:将git repo从项目重新定位到工作区

Spo*_*ike 1 eclipse git version-control refactoring relocation

我已经在Eclipse插件项目上工作了一段时间,而且我遇到了需要将项目拆分为从插件包中分离测试用例的情况.我正在使用git作为版本控制.

简单地描述一下,我正在对这个旧项目进行版本化:

workspace/
  |
  +-- myplugin/
         |
         +-- .git/ <-- Here be the git repository
         |
         +-- /* Source code, project stuff, etc. */
Run Code Online (Sandbox Code Playgroud)

...我正处于需要在单独的项目中处理插件测试的情况下(因此不需要jUnit作为插件的必需包).我希望存储库能够对工作区中的所有内容进行版本控制.像这样:

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

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

Mar*_*rko 5

这是伪代码的工作流程:

cd workspace/myplugin
mkdir myplugin
git mv * myplugin # you might need to do that for all files/folders manualy
mkdir myplugin-test
# move/add files to myplugin-test
git commit -a -m "Reorganization"
cd workspace
mv myplugin myplugin_old
mv myplugin_old/* .
# you should end up with requested structure