Eclipse: Relocating a git repo from project to workspace
-
04-07-2019 - |
Question
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.
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:
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?
Solution
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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow