How grep through your staged files prior to committing?

后端 未结 3 787
灰色年华
灰色年华 2021-02-19 22:05

So prior to running git commit I often will run the following:

git grep --cached -l -I \"debugger\"

I thought it was similar to:

3条回答
  •  执笔经年
    2021-02-19 22:21

    If you have a Unix-like shell available, the answer is pretty simple:

    git grep --cached "debugger" $(git diff --cached --name-only)
    

    This will run git grep on the list of staged files.

提交回复
热议问题