Show commit history in repository
Most of the times the commit history in a Git repository is used. The git commit log of the whole repository (and within your current branch) can be seen with git log:
ck@mint ~/Git/check_rancher2 $ git log
commit 4c69deb450331404f31ba5191addfe1d9fe2c403 (HEAD -> token, origin/token)
Author: Napsty <[email protected]>
Date: Fri Jun 13 16:03:45 2025 +0200
Add api-token check type, output fix in local-certs check, fix --help
commit 8f6e1fb98c5678d8005eaa7272953d93e9256a9c (tag: 1.12.1, origin/master, origin/HEAD, master)
Author: Claudio Kuenzler <[email protected]>
Date: Fri Dec 8 12:45:22 2023 +0100
Use 'command -v' instead of 'which' for required command check (#44)
[...]
In a small repository with only a few files this might already be helpful. However in repositories with a large number of files and multiple developers, the full git log shows too many commits.
Show commit history of a single file
To get the git commit history of a single file inside a repository, you can append — path/to/file to the git log command:
ck@mint ~/Git/check_rancher2 $ git log -- icinga2/command_check_rancher2.conf
commit 4c69deb450331404f31ba5191addfe1d9fe2c403 (HEAD -> token, origin/token)
Author: Napsty <[email protected]>
Date: Fri Jun 13 16:03:45 2025 +0200
Add api-token check type, output fix in local-certs check, fix --help
commit 3774696ae67e9160f4f5f5f8b429c26bda79bbec (tag: 1.12.0)
Author: Claudio Kuenzler <[email protected]>
Date: Thu Feb 2 15:14:26 2023 +0100
Adding "local-certs" check type (#43)
Added local-certs check type
commit be7de60fe9d19bd993cad486b419f5161dd4eacc
Author: Napsty <[email protected]>
Date: Fri Jun 10 07:14:52 2022 +0200
Bump version, adjust Icinga 2 command object
[...]
This now only shows the commits which affected this specific file.
Show code change in commit history
With yet another parameter (-p), the code change for each commit can also be seen. This is very helpful for looking through the recent changes of a file: