I want to see all TODO comments that only I wrote and that exist in the current code base that is git managed.
What I've got so far is printing all TODO comments that I've ever created or modified during the complete git history: git log -p --author="My name" -S TODO | grep "\+.*TODO"
But this tool chain lists all TODO comments ever written, even those that I've already resolved and thus removed again from code.
What’s a suitable tool chain that can search the current code base line-by-line, check if it contains "TODO" and if this line was authored by me print those lines?
`git log` command is used to view the commit history and display the necessary information of the git repository. This command displays the latest git commits information in chronological order, and the last commit will be displayed first.
The file is located in the . git folder, the file is named "COMMIT_EDITMSG". Show activity on this post. This will allow you to modify your commit, as well as your commit message on your local branch.
To search the code in all repositories owned by a certain user or organization, you can use the user or org qualifier. To search the code in a specific repository, you can use the repo qualifier. user:defunkt extension:rb matches code from @defunkt that ends in . rb.
Use it like so from the command line: todo Check if feature X works under edge-case. This records an empty commit prefixed with "TODO". This way git log will remind you both what you have done on this branch and what you need to be doing: $ git log --oneline master..
You can combine git blame
with grep.
Like this (not the best one, but should work)
git grep -l TODO | xargs -n1 git blame | grep 'Your name' | grep TODO
Improved versions might combine line numbers found by first grep with git blame
's ability to show only given lines.
I want do add on aragaer's and Kyle's solution:
git grep -l TODO | xargs -n1 git blame -f -n -w | grep "$(git config user.name)" | grep TODO | sed "s/.\{9\}//" | sed "s/(.*)[[:space:]]*//"
This prints:
Cpp/CoolClass.cpp 123 //TODO: Do we really need this? Cpp/AnotherClass.cpp 42 //TODO: Do we miss something? Java/MyListener.java 23 //TODO: Optimize
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With