Overview
This is a guide focused on collaborating on Android projects together with teammates using Git.
Setup Git
First, you need to properly setup git for your project:
git init
Next, setup a .gitignore file at the root with the contents from this file to ignore files that shouldn’t be shared between collaborators.
If you have already committed files and need to remove them after adding the ignore, you can run this command to remove them before committing.
git rm -r --cached .
You can now add the initial files to git using the SourceTree / Github client or by typing:
git add .
git commit -am "Initial commit"
Next, make sure you have setup a repository on github and then add that repo as the origin:
git remote add origin git@github.com:myusername/reponame.git
and now go ahead and push the code to Github with:
git push origin master
You can also use your favorite Git GUI (for example the Github client) to do a lot of this process as well.
Importing Shared Projects
When first importing a project generated by another person run the following in Eclipse:
Package Explorer -> Right click the project -> "Android Tools" -> "Fix Project Properties"
Project -> Clean
Then review this detailed import troubleshooting guide if you are still running into problems while compiling. This likely involves having to cleanup the dependencies for the project.