Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recursively ignore folder in git

Tags:

git

How to ignore all folders with name build, bin. I tried doing this

**/bin/
**/build/

but it doesn't work. in git status i see

#   new file:   BS/server/build/obj/sender.o
#   new file:   BS/server/build/obj/sendistate.o
#   new file:   BS/server/build/obj/serializedata.o
#   new file:   BS/client/bin/gc.sample.xml
#   new file:   BS/client/bin/mkab.qss
#   new file:   BS/client/bin/mkaberr.qss
#   new file:   BS/client/build/debug/application.qss
#   new file:   BS/client/build/debug/config.xml
like image 314
k_zaur_k Avatar asked Nov 01 '13 06:11

k_zaur_k


People also ask

How do I ignore a specific folder in git?

Personal Ignore Rules Patterns that are specific to your local repository and should not be distributed to other repositories should be set in the . git/info/exclude file. For example, you can use this file to ignore generated files from your personal project tools.

Is git ignore recursive?

When created in the top level directory, the rules will apply recursively to all files and sub-directories throughout the entire repository. When created in a sub-directory, the rules will apply to that specific directory and its sub-directories. When a file or directory is ignored, it will not be: tracked by Git.

Can you have Gitignore in subdirectories?

gitignore in every subdirectory. This way you can ignore files on a finer grained level if different folders need different rules. Moreover, you can define repository specific rules which are not committed to the Git repository, i.e. these are specific to your local copy.


1 Answers

If you want to ignore directory, you should be "directoryname/". For example

bin/
build/
like image 183
ton Avatar answered Oct 18 '22 11:10

ton