The HEAD reference always points to the last commit of the current branch. Therefore, you can use git-show to display the log message and diff output of the latest commit.
Git file History provides information about the commit history associated with a file. To use it: Go to your project's Repository > Files. In the upper right corner, select History.
Find what file changed in a commit To find out which files changed in a given commit, use the git log --raw command. It's the fastest and simplest way to get insight into which files a commit affects.
To see the diff for a particular COMMIT hash, where COMMIT is the hash of the commit: git diff COMMIT~ COMMIT will show you the difference between that COMMIT 's ancestor and the COMMIT .
git show <commit-id>
Documentation for git show
Does
$ git log -p
do what you need?
Check out the chapter on Git Log in the Git Community Book for more examples. (Or look at the the documentation.)
Update: As others (Jakub and Bombe) already pointed out: although the above works, git show is actually the command that is intended to do exactly what was asked for.
git show <commit>
To show what a commit did with stats:
git show <commit> --stat
To show commit log with differences introduced for each commit in a range:
git log -p <commit1> <commit2>
<commit>
?Each commit has a unique id we reference here as <commit>
. The unique id is an SHA-1 hash – a checksum of the content you’re storing plus a header. #TMI
If you don't know your <commit>
:
git log
to view the commit history
Find the commit you care about.
I found out that "git show --stat" is the best out of all here.
It gives you a brief summary of the commit and what files you added and modified without giving you whole bunch of stuff, especially if you changed a lot files.
This is one way I know of. With git
, there always seems to be more than one way to do it.
git log -p commit1 commit2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With