Git log, or: where am I right now

Table of contents

There’s no project I don’t fully commit to. I go as deep as I can, trying to understand the business idea and the end users so I can add value from any angle. But when I’m done, I forget everything with the same intensity. So sometimes, when I come back, I honestly don’t know where I am.

I’ve just come back to this repo after weeks/months. What happened here and where do I stand?

Lack of continuity forces you to spend time remembering what you already knew, recovering what you forgot. And when everything finally makes sense again and you have the next steps and tasks planned, you sit down to code and—surprise → if you left things messy when you left, they’re still messy when you come back.

More branches than I’d like to see, and now it’s time to do some memory archaeology to figure out whether they’re merged features, forgotten work, temporary experiments, or discarded ideas.

Git log

These are the three commands I always use to orient myself:

git log -20 --oneline — because 20 commits are usually enough

git log --oneline --graph --decorate --all — because it helps me read the past: merges, branches, hotfixes, and PRs

git log --oneline main..development to check which commits one branch has that the other doesn’t, or git log --name-status main..development to list the files along with their status.

Save it as an alias → git config --global alias.lg "log --oneline --graph --decorate --all" and use it like this → git lg

What happened to this file?

When I care about a specific file, I inspect it directly → git log -- path/to/file even if it was renamed → git log --follow -- path/to/file and if I want to see the exact changes → git show <commit> -- path/to/file

When and why was this line added?

Not to blame anyone, but to understand past decisions → git blame path/to/file

Merged branches

From this jungle, what can be deleted? Merged branches → git branch --merged but you can also check the unmerged ones → git branch --no-merged

Git diff

Sometimes commit messages aren’t enough, so it helps to see the actual differences between branches → git diff main..development if there are too many changes and it becomes hard to read, it’s better to start with the file names → git diff --name-only main..development and then inspect a specific file → git diff main..development -- path/to/file

You can also compare two commits → git diff --name-only HEAD..33a918ac

Conclusion

Deep down, what happens is that when project immersions are fast, intense, and short-lived, knowledge stays in short-term memory—like studying for an exam and forgetting half of it three months later.

To fight this, the most effective solution is to quit programming. No—better yet, leave everything clean and documented before you leave, so it’s ready when you come back.

Deleting already-merged branches or archiving discarded ones is crucial. And knowing how to use Git is too—not just as a tool to store code, but as a way to recover context, understand past decisions, and think clearly about the future.

Resources

git log

comments powered by Disqus

If you find it interesting

If you have any doubt or you want to chat about this topic, as if you find interesting the content or our profiles and you think we could build something together, do not hesitate to contact us trough the email address hola@mamutlove.com