How to add files in .gitignore in Android Studio?

-1

At some point in our project, the local configuration files ( workspace.xml , app.iml ) were sent to git . Among these files, some of the gradle itself ( cache.properties.lock , fileHashes.bin , fileSnapshots.bin , outputFileStates.bin , taskArtifacts.bin ).

I believe these files were in .gitignore , but I can not replace them, and now every pull these same files give conflicts because they are settings changed by the IDE locally.

How can I add them again? Should everyone be in .gitignore ?

    
asked by anonymous 04.09.2015 / 13:49

1 answer

1

As you may know, you need to add these files to .gitignore.

But gitignore only serves to ignore files that are not in source control (so that they are still not versioned). If they are already being versioned (or tracked ), then you need to delete them locally, and commit with those deletions. After that, you can restore them, and they will be ignored by Git.

In short:

  • Backup the files in another folder
  • delete them from the project
  • commit these removals
  • restores files
04.09.2015 / 14:04