1

At work we are now in the process of migrating from Eclipse to Android Studio, but one of the challenges we are facing is actually keeping all of our local history from git when the import is done.

I followed this directions to do the merge with git: https://stackoverflow.com/a/24741965/2489037

...And my co-workers are able to download the whole project from git using SourceTree with no major problems, but we are still unable to compare any of the project's files with the remote versions from other branches (The ones we were using with Eclipse). When I left-click a file -> git -> compare with branch... then select one of the Eclipse branches (That I know has the file) I get the error: File Doesn't exist in branch

So, the question is: How can we compare files from the imported Android Studio Project with their pairs in the Eclipse branches? Is it possible?

We really can't lose the local history, and we also can't be switching back to Eclipse all the time to check older versions of the files.

Community
  • 1
  • 1
Dp1nto
  • 36
  • 5

2 Answers2

0

Has the file path moved in the repository? It may be that the git client in the new IDE isn't capable of following renames. You should be able to determine whether or not the commits are there with a command-line client; that will tell you whether it's the IDE or the repository that has the problem.

AlBlue
  • 23,254
  • 14
  • 71
  • 91
  • Yes, precisely all the files paths were pointing to where they should be if the project was in Eclipse... since we are moving to AS these paths had to be updated as well. Thank you. – Dp1nto Jul 09 '15 at 14:03
0

Solved:

As it turned out, even thought the project was recognized by Git and I was able to switch between branches (Meaning that the project structure changed to adapt to Eclipse or Android Studio), the files had a different path so git wasn't able to relate them to the older versions. For the solution I followed this steps:

  1. Being in the Android Studio branch, I copied the res and src folders from where they belong in the AS project structure to where they should be if the project was made in Eclipse (the main folder).

  2. Using a command line I moved the files back to where they belong with the command git mv -v -f source_folder destination_folder

  3. Done! Now AS is able to compare the java files with the older versions using left-click -> git -> compare with..

I still can't compare with other branches because the path for the files is different, but since we are not going to continue using those branches because we are not going to develop in Eclipse anymore, this solution works for us, given that we have access to all the previous version of the files for future reference.

AlBlue
  • 23,254
  • 14
  • 71
  • 91
Dp1nto
  • 36
  • 5