How to add the files in . gitignore in Android Studio?

Asked

Viewed 475 times

-1

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

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

How can I add them again? Everyone should be on .gitignore?

  • I do not understand the intention. You want to remove them from the source control?

  • That’s right, since these files are generated by each programmer in their IDE, we don’t need to upload them to git, avoiding conflicts with each pull.

1 answer

1


As you may already 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 continue not to be versioned). Whether they are already being versioned (or tracked), then you need to delete them locally, and commit those deletions. After that, you can restore them, and they’ll be ignored by Git.

In short:

  • make a backup of the files in any other folder
  • deletes them from the project
  • commit to these deletions
  • restores the files
  • That worked for me, thank you!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.