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

时间:2021-12-19 19:00:13

I've been working on an Eclipse plug-in project for a while now, and I've run into a situation where I need to split the project up to seperate the test cases from the plug-in package. I'm using git as version control.

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

To describe this simply, I'm versioning the old project like this:

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

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

…and I'm in the situation where I need to work the plugin tests in a seperate project (so that jUnit won't be needed as a required bundle with the plugin). And I'd like the repository to version everything in the workspace. Like this:

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

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

Is there a simple way to do this without losing the history of the old project?

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

1 个解决方案

#1


5  

Here's the workflow in pseudocode:

这是伪代码的工作流程:

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

#1


5  

Here's the workflow in pseudocode:

这是伪代码的工作流程:

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