Is it possible to add to gitignore separate lines?

At work sometimes we have to use wardany, console logs, etc. At intermediate commits, you have to remove all the extra lines, and then return if they still need, what, exactly, tiring, and sometimes some to clean let forget.

Therefore interested in whether you can exclude commits a separate line?
April 19th 20 at 12:05
3 answers
April 19th 20 at 12:07
Create your own log or vardump function that echo data only in development

mylog function(data) {
 if(getEnv("APP_ENV") == 'dev') {

It's just the idea that a function can be slozeni. She can write to a file or to the console. Or when razrbet to the console, but in production to a file.

Good code should be well caloghirou. So delete is not necessary. While your application is under development, we will see all logs and dumps. But maybe not. A good logger has levels. For example if you are level debug, you will see all the dumps and logs if the level inofmration, only logs, etc.

One variable can then toggle what to show and what not. For example, VA need you to debug a piece of code which was not written by you. What to do? Arrange the logs again, then delete? No, just switch to the logger and you can see everything.
April 19th 20 at 12:09
gitignore only works with files.
For such things it is better to use conditional compilation/flags/start custom loggers
April 19th 20 at 12:11
Well, as an option, a pre-commit hook that will clean up the files before committing.
Sounds matershiny. Tipo: you Go on hook, the dirty code! )))))) - Gretchen_Monah commented on April 19th 20 at 12:14

Find more questions by tags Git