脚本来查找所有在git分支上创建的TODO注释? [英] Script to find all TODO comments created on a git branch?

查看:125
本文介绍了脚本来查找所有在git分支上创建的TODO注释?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个功能分支,增长得相当大。在我们的代码中有很多逗留的TODO注释,但是我想找到所有添加到代码中的TODO(并且尚未删除)尚未合并到master中的提交。我可以怎么做呢?

解决方案

您可以简单地将您的分支与输出中的TODO的master和grep进行比较

  git diff master..branch | grep^ +。* TODO

这对我在TODO行中假设足够的上下文非常有用。

I have a feature branch that's grown quite large. There are quite a few lingering TODO comments in our code, but I'd like to find all TODOs added to the code (and not removed yet) on commits not yet merged into master. How might I go about that?

解决方案

You can simply diff your branch against master and grep for TODOs in the output

git diff master..branch | grep "^+.*TODO"

This works great for me assuming enough context in the TODO line.

这篇关于脚本来查找所有在git分支上创建的TODO注释?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆