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
For instance; you wrote bash
scripts 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
Which basically says: on the line “274” [Ss]cripts
causes to ignore your
scripts
directory.
All done.