The default .gitignore file in Android Studio is good enough but not great. Whenever an IDE or SDK update takes place, files change and need to be committed to git. This becomes a bigger problem when the project is checked out on more than one computer. You will need to update projects on command line first prior to opening the projects in Android Studio.
The .iml and .xml files seem to be what changes after an update. By adding a recursive **/*.iml directive, you cover the multi module projects for mobile and wear development. Adding more of the .idea/ .xml files to .gitignore prevents the nagging commit issues.
Android Studio 2.3.1 .gitignore file
**/*.iml
.gradle
local.properties
.idea/workspace.xml
.idea/compiler.xml
.idea/encodings.xml
.idea/misc.xml
.idea/modules.xml
.idea/vcs.xml
.idea/libraries
.DS_Store
**/.DS_Store
build
captures
.externalNativeBuild
*.log
After updating the .gitignore file, you will need to remove some files from your git repository. This takes the files out of source control and these files will not be available on a clean checkout using git clone. Android Studio 2.3.1 re-creates the missing files on clean checkouts so your projects will not break.
git rm --cached .idea/workspace.xml
git rm --cached .idea/compiler.xml
git rm --cached .idea/encodings.xml
git rm --cached .idea/misc.xml
git rm --cached .idea/modules.xml
git rm --cached .idea/vcs.xml
Locate all *.iml files and ‘git rm –cached’ remove them as well.
Commit your changes to git
git add .
git commit