Git does not ignore certain subdirectories

Asked

Viewed 116 times

0

I recently started a personal project for practice, and one of the things I wanted to do was to have the "src" folder containing the source of the project, but every time I tried to get some part of that directory to be ignored by git, this didn’t happen? It has to do with the name of the folder?

  • Probably not. But there’s no way of knowing what the problem is without you describing exactly what you did. You may have missed something.

  • Pablo, I performed a test with your project and it seems that you are ignoring the files: http://prntscr.com/co8r82 . Could show us a case that wrong or a practical test for us?

1 answer

2

Git controls files, not folders! You can test this by creating an empty folder and using Command:

git add *

You will see that it does not add the folder to staging.

Git works with pointers to files. And it’s only the ones you have to worry about, so if you want to ignore all the files in a folder you will have to do a regex:

[Bb]in/

That ignores all files (dll, obj, ...) in Bin folder, starting it with b or B.

Interesting references to . gitignore:

https://help.github.com/articles/ignoring-files/

https://github.com/github/gitignore

https://www.gitignore.io/

Browser other questions tagged

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