git view commits code example

Example 1: list commits in git

$ git log --oneline

Example 2: 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 3: git clear commits

git reset --hard origin

Example 4: github show files changed git log

git log --name-only

Example 5: to see all after commit in local repository in git

git log --name-only