0

When creating a new project with Android Studio and also creating a new git repository, there are quite a few untracked files present:

$ git status
On branch master

No commits yet

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        .gitignore
        .idea/
        app/
        build.gradle
        gradle.properties
        gradle/
        gradlew
        gradlew.bat
        settings.gradle

nothing added to commit but untracked files present (use "git add" to track)

Which of these should I track?

Obviously I'd want to track everything in app/src. But should I track everything in app as well?

app/build.gradle
app/libs/
app/proguard-rules.pro
app/src/

I tend to say yes.

For the .idea/ folder I already found a discussion here.

The .gitignore file I think I'd like to track as well.

That leaves the gradle files. Which of these are project specific (should be tracked) and which are environment specific (should not be tracked)?

My goal is for git status to show no untracked files (thus, everything not tracked should be ignored).

user1785730
  • 3,150
  • 4
  • 27
  • 50
  • 1
    Go to [GitIgnore.IO](https://gitignore.io) and search for AndroidStudio. That will give you a template with most of what you need. Note: You may want to look for general Java .gitignores from there or elsewhere as well, and maybe specifically IDEA and Gradle. – LightCC Jul 29 '20 at 18:38
  • And track everything else? Thus after updating `.gitignore`, should I just run `git add *`? – user1785730 Jul 29 '20 at 18:48
  • 1
    @user1785730 Basically yes. When testing new `.gitignore` files, always thoroughly check what is getting added to make sure the filters are working the way you want. – LightCC Jul 29 '20 at 19:54

0 Answers0