使用Git和Eclipse管理Android项目 [英] Managing Android project using Git and Eclipse

查看:119
本文介绍了使用Git和Eclipse管理Android项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我相信我有一个非常普遍的问题,影响了开发者使用多个版本的应用程序(在我的情况下,我有两个:付费的和免费的)。
为了管理这两个版本,我使用了与2个不同分支相同的git项目:免费和付费
但是,我的源代码包名称彼此不同(如预期的那样),并且具有目录名称映射到包名会出现一个问题:如何让git将某个目录下的文件与每个分支关联?



让我给你一个例子:
我有两个分行:
$ b


  1. 主人

  2. 免费

在master中,我的源代码位于com.zemariamm下,但是在free分支中,源代码位于com.zemariamm.free下,我该如何配置git totell himcom.zemariamm目录下的源代码(分支主目录)映射到目录com.zemariamm.free下的源代码(免费分支)?

事先感谢,
Ze

解决方案

理论上,你不会在Git中配置任何东西:

如果 com.zemariamm.free.MyClass content 非常类似于 com.zemariamm.MyClass ,Git应该能够链接两个不同分支中两个目录之间 MyClass 文件的历史记录。



特别是,从 free master 的合并应报告新的演变(添加,修改或删除的行到 MyClass )从 com.zemariamm.free.MyClass com.zemariamm。 MyClass的



只有当 MyClass 在两个分支之间足够类似时才起作用:

请参阅 Git如何跟踪历史记录重构?


I believe I have a very common problem that affects developers with multiple versions of their apps (in my case I have two: paid one and a free one). To manage both versions I use the same git project with 2 different branches: free and paid However my source code package names differ from each other (as expected), and with the java restrictions of having the directory names mapping to package names a problem arises: how to tell git to associate the files under a certain directory with each branch ?

Let me give you an example: I've two branches:

  1. master
  2. free

In master my source code is under com.zemariamm, however in the "free" branch the source code is under "com.zemariamm.free", how can I configure git to "tell him" that the source code under directory com.zemariamm (in branch master) maps to the source code under directory com.zemariamm.free (in branch free) ?

Thanks so much in advance, Ze

解决方案

In theory, you wouldn't configure anything in Git:
If the content of com.zemariamm.free.MyClass is very similar to com.zemariamm.MyClass, Git should be able to link the history of the MyClass file between the two directories in the two different branches.

In particular, a merge from free to master should report new evolutions (lines added, modified or removed to MyClass) from the com.zemariamm.free.MyClass to the com.zemariamm.MyClass.

That only works if MyClass is "similar enough between the two branches though:
see "How does Git track history during a refactoring ?"

这篇关于使用Git和Eclipse管理Android项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆