dont-care-log
Teach git stage/diff how to ignore specific logging code,
so your logging code will never be commit automatically,
of course also wont show dirty in git
.
Example
Assuming that a new file in you project like:
import path from 'path'
const getFile = () => {
const name = 'foo'
const file = path.join(__dirname, name)
console.log('TCL: getFile() -> name:', file)
return file
}
and with installed dont-care-log, you will only see this output below on git status/add/diff
commands
+ import path from 'path'
+
+ const getFile = () => {
+ const name = 'foo'
+ const file = path.join(__dirname, name)
+ return file
+ }
Amazing, there is no line of console.log('TCL: ...)
Install
npm i -D dont-care-log
and Turbo Console Log for VSCode
How it works
dont-care-log only teach git to ignore the specific format line which is prefixed with any spaces and console.log('TCL:
(default format of Turbo Console Log).
Well, here defined a filter.clean
pipe to drop the specific line (generated by Turbo-Console-Log),
and some preinstall
hook to setup .gitconfig
and .gitattributes
.
More details of git add/staging
workflow see: > git-scm staging
In simple terms, filter.clean
for staging, filter.smudge
for checkout
Next
License
MIT LICENSE