Use Git like a senior engineer

Git is a powerful tool that feels great to use when you know how to use it.

Jacob Bennett
Level Up Coding
Published in
4 min readNov 15, 2022

--

I’ve used these features of Git for years across teams and projects. I’m still developing opinions around some workflows (like to squash or not) but the core tooling is powerful and flexible (and scriptable!).

Going through Git logs

Git logs are gross to go through out of the box.

git log is basic

Using git log gives you some information. But it’s extremely high-resolution and not usually what you’re looking for.

git log
git log

Let’s be real. These logs aren’t impressing anyone. They are boring. And they’re full of information that you don’t really need right now. You’re trying to get a high-level understanding of what has been going on in your project.

There’s a better way.

git log with more visibility

Using --graph and --format we can quickly get a summary view of git commits in our project.

git log --graph --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%an%C(reset)%C(bold yellow)%d%C(reset) %C(dim white)- %s%C(reset)' --all
git log --graph --format=format:’<>’ --all

Wow! These are some good-looking logs! There’s even a semblance of a branched tree beside it.

These logs show you who has been working on what, when changes were made, and where your changes fit into the bigger picture.

--graph adds the tree graph to the left. It’s not the most stylish graph, but it helps to visualize changes in the project’s branches. (Read the docs here.)

--format lets you customize the format of your logs. There are preset formats to choose from, or you can write your own format like this example. (Read the docs here.)

--all includes all of the refs, tags, and branches in the logs (including remote branches). You might not want everything so adjust this as you see fit. (Read the docs here.)

--

--

Staff Software Engineer @ Medium • https://jacob.bio • I write about software engineering, product design and development, and leadership in tech.