I had an old Android project that I think I had started in Eclipse or some old version of Android Studio. Anyway the project structure was completely different from how Android Studio organizes things now with Gradle. Rather than try to update every file location I just started over with a new project using the same name.
Now I would like to update my GitHub repository but I don't want to lose my previous commits, which doing something like git push --force origin master
would apparently cause (see here and here).
This question is similar to Replace GitHub repo while preserving issues, wiki, etc, but I would like to know for the specific case of Android Studio. Also the current answer to that question does not preserve the commit history.
I am going to try to figure out a way to do this based on hints from here and here. If I can solve it, I will post my answer below.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…