Android Studio Git .gitignore vs Project > Settings > Version Control > Ignored Files

Ok to answer my own question. To go back to using .gitignore, do the following:

  1. Go to Settings > Version Control > Ignored Files and remove all ignored files. Hit Apply.
  2. Still in Settings > Version Control change the type of version control from Git to none. Hit Apply.
  3. Delete the project’s .git directory created previously.
  4. Create the following .gitignore file in the root directory of your project:
    https://stackoverflow.com/a/21049338/459095
  5. VCS > Enable Version Control… to Re-enable Git.
  6. Then right click on the project root and select Git > Add to add the entire project.

Doing the above will utilize the .gitignore file instead of Settings > Version Control > Ignored Files to commit the right files.

For me the process was a little easier:

  1. In Android Studio: Settings > Version Control > Ignored Files >
    Remove all ignored files > Apply
  2. Backup .gitignore. Create an empty new .gitignore. (in the root folder)
  3. Restart Android Studio!
  4. Fill up the new .gitignore with the old one. Don’t forget to commit the change .gitignore + related ignored/deleted files!

No re-enable VCS required! I’m working with a GitRepo, which is extremely inconvient to do re-enabling VCS. The steps helped.

Leave a Comment