You may be a new joiner to your organization or someone who is already working in a firm for many years. One day you're sitting on your chair and suddenly one thought came into your mind.
One challenge could be that you might be relying on external packages, preferably open-sourced, or some code coverage folder might be already present from the last time you have run your test. You can delete them, fair point but then you have to create the coverage or install all of the dependencies again. Only if there is a way adhere my
.gitignore rules then the world could have been a little more perfect.
Turns out, there is a way out 💡
git ls-files | xargs cat | wc -l
Running this command will give you the total number of lines in your project.
There are two parts in this process, well, as you can see there are three parts but you can think the last two commands as singular. The last two commands are there basically to count the number of lines only. The first command is a kind of interesting one which lists all the files that currently present in your repository and excludes the one who is ignored in your
.gitignore file. So there you have it.
You can also tweak git ls-files command to check the lines for specific extensions.