My Git Book Writing Blog

Using Git for the Book (Part 3): Catching Forgotten Work

I’m the only person committing to my repository. However, despite working alone, I still can flub up my Git repo. This means that I sometimes forget to pull in work from the last time I pushed work (the workflow I described in Part 1 of this series).

Using the command git log --merges, I can see every time where this time happened. For the record, this happened 21 times (so far). Every merge means I forgot about work I did!

One of the first times this happened was when I performed a git commit --amend. This command allows you to update the latest commit of your current branch. However, I had already pushed my change to BitBucket, so when I pushed again, Git complained.

More typical though is that I make a change to a text file on my Linux machine, then make a change to an MS Word document on my PC machine. Git forces me to merge these two pieces of work. It’s amazing to me how quickly I can forget what I’ve already done.

It’s cool that Git can help me figure out what I was doing in another part of the repository. No work is forgotten if you are diligent about committing to your repository. A simple git log or (if need be) a more involved git checkout operation is enough to remind myself that Git can keep even a solo worker organized.

Thanks for reading!