1

I imported an existing project from Eclipse into Android Studio, which reorganized the project structure. I made minor edits to compile and deploy then realized the .git wasn't migrated.

How do I bring in that old repo with history and begin committing again, new structure and all?

es0329
  • 1,366
  • 1
  • 18
  • 35
  • Wondering if I can just `mv` or `cp` like I'd do other files. – es0329 Jul 02 '14 at 15:39
  • possible duplicate of [Import an eclipse android project with version control system into Android Studio](http://stackoverflow.com/questions/24726041/import-an-eclipse-android-project-with-version-control-system-into-android-studi) – Bob Jan 06 '15 at 22:20

2 Answers2

1

Here is the step by step solution to do it.

  1. Open Android Studio -> Import Project-> Select your project directory. (In above case "MyApp") Remember Select the directory which contains Manifest file otherwise new "direct import wizard" doesn't get triggered and android studio uses old import wizard.
  2. Android Studio will create a copy of your project "MyApp_imported" with new directory structure.
  3. Copy your existing ".git" directory inside "MyApp_imported"
  4. Android Studio -> VCS -> Enable version control This will make Android Studio use your existing repository for imported project. Though imported project has different directory structure but git handles them pretty well.
  5. Android Studio -> Changes Review all files and commit. Git will automatically handle new directory structure and file history etc will not be lost.
  6. Now you can share it on github/Bitbucket by VCS-> Share it on GitHUb Note:- For bitbucket you will have to install "following Bitbucket plugin" for Android Studio. http://plugins.jetbrains.com/plugin/6207?pr=androidstudio
Shakti Malik
  • 2,335
  • 25
  • 32
0

You're entirely correct, you can just cp or mv the .git folder into the root of the new directory. Keep in mind though that since files have been moved around, created, and deleted without using git mv/git add/git rm, you'll have to do some cleanup to get the repository to reflect these changes.

Derek Redfern
  • 1,009
  • 12
  • 18