Comment by bravesoul2
1 day ago
Also just chuck Todo comments in the code
The magic of Git means you can immediately find them in the working index and get back on to it. Just remember to remove them before the commit.
1 day ago
Also just chuck Todo comments in the code
The magic of Git means you can immediately find them in the working index and get back on to it. Just remember to remove them before the commit.
> 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:
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:
or, case insensitive variant:
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 :)
1 reply →
They'll show up in the diff.
Grep will find them too, but any in the diff you'll know for sure were added by you.
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?
1 reply →
If you do this often enough you can create a simple commit hook that searches for these markers and will fail to commit if it finds them.