How does git help you find certain texts in files? `grep` should do the trick just fine, unless I misunderstand what "chuck Todo comments in the code" mean, the code lives on your disk no?
How does git help you find certain texts in files? `grep` should do the trick just fine, unless I misunderstand what "chuck Todo comments in the code" mean, the code lives on your disk no?
git status && git diff HEAD
That will tell you which files you've touched and will show you their diffs. If necessary you can search within the diff: press '/' to bring up the search feature (assuming you're using the default less pager).To search for all mentions of 'TODO' in the repo, ignoring untracked files:
git grep TODO
or, case insensitive variant: git grep -i TODOBasically, my assumption is that `gq` should return empty, which means I have a clean slate, and can start taking on new work. Otherwise, there is ongoing work that needs attention.
It just lists:
* modified/untracked files
* stashed changes
* local-only branches (not tracking a remote branch)
* branches out-of-sync with their upstream (either ahead or behind)
* branches that aren't the main branch (even if tracking and in-sync with a remote upstream)
Getting this command to return empty is a surprisingly effective way to stay productive, especially when losing focus due to too much work.It's basically inbox-zero for git.
But it only works if you like working with a clean worktree.
Grep will find them too, but any in the diff you'll know for sure were added by you.
And why it matters to get them from the diff if they're on disk already? Literally one command to find all of them, rather than going through git?