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

时间:2008-10-24 11:44:48

标签: eclipse git version-control refactoring relocation

我一直在研究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… */

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

1 个答案:

答案 0 :(得分: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
相关问题