DEV Community

Serhat Teker
Serhat Teker

Posted on • Originally published at tech.serhatteker.com on

Git Which Ignores

You just started a new project that a team has working on for a while and like to add your code into the codebase. Or you want to use a well-known webapp template for your new project.

You wrote the code, made your tests and then added your "piece of magic" text but it doesn't show up in version control. git status not showing your file or directory. Also you can't check manually .gitignore since it is 450 lines long.

The solution? Use built-in git command check-ignore:

$ git check-ignore -v filename
Enter fullscreen mode Exit fullscreen mode

For instance; you wrote bashscripts for some automation and added them in a directory called scripts in the project root. When you use check-ignore it would give some output like below:

.gitignore:274:[Ss]cripts       scripts
Enter fullscreen mode Exit fullscreen mode

Which basically says: on the line "274" [Ss]cripts causes to ignore your scripts directory.

All done.

Top comments (0)