Switching coding tasks is mentally exhausting. I switch between tasks at work, tasks on side hustles, and tasks on shiny-new-technology explorations. In between those tasks I insert sleep, eating, family time, walking the dog, going on vacation, and more, which makes remembering where I left off even more difficult.
I tried keeping a journal of "where I left off" on my tasks and projects. That didn't work because I often switch away from tasks abruptly and don't have the time to update the journal.
When I switch to a task I haven't worked on in a while, I need to answer these questions:
- Which files was I working on?
- What changes did I make to those files?
- (Optional) What had I just finished working on?
If only there were a tool that did this for me. Wait, there is: Git does this!
Here's how Git answers each of the above questions.
1. Which files was I working on?
Editor or desktop app: Look for indicators in the source tree -- filename colors or icons.
Command line: git status
2. What changes did I make to those files?
Editor or desktop app: Look for a "changes" panel or dialog to navigate recent additions and modifications.
Command line: git diff
3. (Optional) What had I just finished working on?
Editor or desktop app: Look for a "history" panel or dialog to navigate recent commits made to the repository.
Command line: git log
Easy peasy, right? Not so fast. This only works if I make frequent Git commits. If I switch from one task to another and find 33 new and modified files, then I'm still going to have to spend 30 minutes trying to remember where I left off.
That's okay, because making frequent Git commits is a good idea for a number of reasons.
- It enourages me to break tasks down into manageable chunks.
- I can quickly back out of bad ideas or experiments and start over from where I was just an hour or two ago.
- Remembering where I left off is much easier.
I hope this helps you as much as it helps me. Time to switch to another task now!
Photo by Mitchell Luo on Unsplash