1

I am currently using Git on the command line to help me incrementally add features without breaking existing code. The part that worries me is this line of output from Git after committing:

[optimized_managed_event 6c9a98c] Added managed event insert into my ContentProvider
12 files changed, 202 insertions(+), 16 deletions(-)
rewrite bin/classes.dex (87%)
rewrite bin/classes/com/zeroe/SmartCalProvider.class (85%)

Should I worry about the rewrites if they are .class files and other types that aren't text? I am fairly new to Git, but am pretty comfortable with the command line and I understand the basic workflow for most Git projects:

> git add .
> git commit -m 'comment on commit'
> git checkout [master]
> git merge [branch]

What I am slightly worried about is issues that can occur when committing, then merging since Android projects have a lot of files that it creates itself in different formats.

My question is essentially in anything I need to worry about when doing this in Android development?

Andy
  • 10,553
  • 21
  • 75
  • 125
  • 2
    You shouldn't put any compiled/generated files in your git repo. [Add them to .gitignore](http://stackoverflow.com/questions/3325736/eclipse-android-and-gitignore). – Piotr Praszmo Jun 23 '12 at 21:55
  • Well lets assume I did, is that bad? And how can I do that? Just add like the file extension in .gitgnore so it ignores all that, or do I have to specify folders? – Andy Jun 23 '12 at 21:58
  • You could use [egit](http://www.eclipse.org/egit/) instead... just saying :) – Alex Lockwood Jun 23 '12 at 22:02
  • lmao @AlexLockwood I did some searching on my situation and that did come up. But I don't want to use that. Though I know its an option. But from what you know, does committing the classes and other automatically created files cause issues? – Andy Jun 23 '12 at 22:27
  • @Andy, sorry... I'm no git expert. I only know enough to get by :P. – Alex Lockwood Jun 23 '12 at 22:30
  • @Andy, Just write the extention in `.gitignore`. This is my `.gitignore`, which is partially found online, and partially self created: http://pastebin.com/KDjpxXp7 – MartinHaTh Jun 23 '12 at 23:17
  • Ahh, @MartinHaTh thanks for that. I don't normally use IDE's, so I am not really sure what I should include. You should probably include that as an answer. – Andy Jun 23 '12 at 23:31

1 Answers1

2

Create .gitignore in the root of your project and add at least the following:

*~
*.apk
bin
gen
local.properties
.apt_generated

This way you avoid putting in repository automatically generated files, which usually blows the repository size up without any reason. The only automatically generated files you might want to save are proguard/ files, which might be necessary to unroll the call-stack after the user-generated crash reports.

Also, I found it's very helpful to have giggle utility installed to see what changes you have in your files.

lenik
  • 23,228
  • 4
  • 34
  • 43