Ignoring files by . gitignore

Asked

Viewed 4,466 times

2

Use the GitLab as a repository for a project Android. I want to ignore the files from the folder openCVLibrary320 at the time of commit/push. I typed the folder as follows in the file .gitignore:

*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.externalNativeBuild
/openCVLibrary320

I altered some file inside the folder openCVLibrary320. By giving the commit was to ignore this file, but it appears to be commited.

inserir a descrição da imagem aqui

What should I do ?

1 answer

5


If the file/folder already exists in the repository, it is not enough to just put it in the gitignore, you also need to remove it from the repository. In other words, you need to warn GIT to stop "watching" the file/folder in question.

The Comano for this is the rm --cached <file>, in your case, it looks like this

git rm --cached openCVLibrary320/
  • worked, thanks

  • That’s right, it happened to me all the time. Only take care if you push directly on the server, as I do, because it deletes the previously indexed contents.

  • Yeah, @Wallacemaxters. That’s exactly the point. If you want to keep the files on the server but not "trackear" the changes need to "assume unchanged" and not put in gitignore.

  • This will save many lives. 1+

Browser other questions tagged

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