Viewing Commit History and Authors (log · blame · show)
Different Ways to View the Commit History
- You can view the commit history with the
git log --pretty=onelinecommand, or withgit historyif you made it into an alias. - With the
-alloption, you can see the commits of all branches, not just the current one.

- When commits get mixed up and confusing, add the
-graphoption to visually check the relationship between branches and commits as a graph.

-graphis especially useful for understanding the flow of branches, such as merge commits.- Combining several options to fit the information you need lets you understand the project's state more accurately.
What If You Want a GUI?
For VS Code, it is convenient to use an extension or install one of the programs available!
- https://git-scm.com/tools/guis
- https://www.sourcetreeapp.com/
- https://www.gitkraken.com/?utm_expid=.W2nHbF0ARIqaOuS7QxW-pA.0&utm_referrer=https%3A%2F%2Fwww.google.com%2F
Finding Out Who Wrote the Code (git blame, show)
This section covers how to check how the code in a specific file has changed over time in Git, and who wrote which code.
A file is completed over many commits, and sometimes you need to look at when and how each piece of code was added.
The command used for this is
git blame.bashgit blame filenameTyping this shows which commit added each line of the file and who wrote it.
If you want to look at a commit ID in more detail,
bashgit show commitIDthis command shows detailed information such as whose commit it is and the commit message.
These features help make responsibility for code clear and encourage each developer to write code carefully.
In short, the git blame and git show commands let you track who wrote the code and its change history.
Summary
| Command | What it does |
|---|---|
git log --pretty=oneline | View the history with one line per commit |
git log --all --graph | View the commit relationships of all branches as a graph |
git blame filename | See which commit, and who, wrote each line of a file |
git show commitID | See a commit's author, message, and changes |
Reference: personal Notion study notes (Git study)
