Configuring Git Version Control for Android Studio Projects with TortoiseGit

Before proceeding, ensure you have the following tools installed:

  1. Android Studio
  2. TortoiseGit and msysGit

Identifying files to exclude from version control in Android projects:

Directories to ignore:

  • .gradle — Gradle temporary directory
  • .idea — IDE-specific temporary files
  • build — Gradle build output directory

Files to exclude:

  • *.iml — Module definition files
  • local.properties — Local SDK paths and settings

Files that should not be excluded:

  • .classpath — Required by ADT/Eclipse, not used by Android Studio
  • .project — Required by ADT/Eclipse, not used by Android Studio

Recommended exclusions in Android Studio:

  • .idea folder
  • .gradle folder
  • All build folders
  • All .iml files
  • local.properties file

Proceeding with setup:

  1. Create an Android Studio project.
  2. Switch to Project view to see all directories.
  3. Open or create the .gitignore file in the root directory.

Replace its contents with one of the following configurations:

# Built application files
*.apk
*.ap_
*.iml

/.idea

# Files for the Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin
gen
.metadata

# Gradle files
.gradle/
buiild/

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

Aletrnatively, use this more comprehensive version:

# Built application files
*.apk
*.ap_

# Files for the ART/Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/
out/

# Gradle files
.gradle/
build/

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

# Android Studio Navigation editor temp files
.navigation/

# Android Studio captures folder
captures/

# Intellij
*.iml
.idea/workspace.xml

# Keystore files
*.jks

This aligns with GitHub's official .gitignore template for Android projects.

Additional customizations can be added under the # Intellij section:

*.iws
.idea/

Explanation of patterns:

  • # — Comment marker; ignored by Git
  • *.iml — Exclude all module definition files
  • .gradle/ — Ignore Gradle cache directory
  • local.properties — Exclude local configuration file

Once configured, locate your project directory and confirm that .gitignore applies recursively to all subdirectories. Adding this file to the repository ensures that all team members share the same exclusion rules.

Using TortoiseGit to commit changes:

  1. Right-click the project folder.
  2. Select "TortoiseGit" → "Commit".
  3. Add files to staging area if needed.
  4. Enter a commit message.
  5. Click "OK" to commit.
  6. Push changes to remote repository.

Verify the committed files in your repository. If .idea folder still appears in the listing, update the .gitignore file accordingly by adding it to the exclusion list.

Tags: Android Git tortoisegit version-control Gradle

Posted on Wed, 05 Aug 2026 16:36:05 +0000 by meediake