Yes. It's funny how this kind of trick can instantly snap the entire working context back into your mind. Essentially leaving you free to forget about the context during your free time and overnight. Truly a useful "hack".
It's also useful to jot down a quick list of (say) three items that are at the top of your mind when you leave work for the day, and they too will help with a context restore.
> The magic of Git means you can immediately find them in the working index
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?
To get your bearings regarding where you got to with your uncommitted work, you might do something like:
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:
I have a very involved `gq` alias that helps me find and finish pending work. It works either in the current repository or a folder containing multiple repositories.
Basically, 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.
I know how to use git :P The question is why use git for something when the TODOs still sits in your files on disk. You're not doing anything with those commands that `grep` by itself cannot do...
Grep works too. I just spend a lot of time in git or tools that wrap it. It's an unconscious habit to check the status and diffs when I open my editor.
Yeah I mean I use the git cli exclusively too, and use it switch contexts, but I'm not sure why'd I use it to find stuff that is already on disk. But, you do you, was just trying to understand if there was any benefits I didn't knew about :)
Parent mentioned specifically finding them from the index, so they've been added but not committed, so they're not even remote nor have an author associated with it, yet.
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?
One advantage of git is it shows you any uncommitted changes. Great way to get context the next day of where you were up to anyway even if you didn't use TODO to make it searchable.
It's also useful to jot down a quick list of (say) three items that are at the top of your mind when you leave work for the day, and they too will help with a context restore.