git history command code example
Example 1: how to see all commits in git
$ git log --pretty=format:"%h - %an, %ar : %s"
ca82a6d - Scott Chacon, 6 years ago : Change version number
085bb3b - Scott Chacon, 6 years ago : Remove unnecessary test
a11bef0 - Scott Chacon, 6 years ago : Initial commit
Example 2: github show files changed git log
git log --name-only
Example 3: git log one line
git log --oneline
Example 4: git log in command line pretty view
$ git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
* 3396763 - (HEAD, origin/master, master) Add twitter link (4 days ago) <Mattias Geniar>
* c73bbc9 - add facebook link (6 days ago) <Mattias Geniar>
* cb555df - More random values (6 days ago) <Mattias Geniar>
* 60e7bbf - Merge pull request #1 from TSchuermans/patch-1 (7 days ago) <Mattias Geniar>
|\
| * 8044a8f - Typo fix (7 days ago) <Tom Schuermans>
|/
Example 5: how to see the commit history in git
$ git log
commit ca82a6dff817ec66f44342007202690a93763949
Author: Scott Chacon <[email protected]>
Date: Mon Mar 17 21:52:11 2008 -0700
changed the version number
commit 085bb3bcb608e1e8451d4b2432f8ecbe6306e7e7
Author: Scott Chacon <[email protected]>
Date: Sat Mar 15 16:40:33 2008 -0700
removed unnecessary test
commit a11bef06a3f659402fe7563abf99ad00de2209e6
Author: Scott Chacon <[email protected]>
Date: Sat Mar 15 10:31:28 2008 -0700
first commit