git log in 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: git log

git log  # show commits
git log -p  # show diff files
git log -p <path>  # show diff specified files

Example 3: git get latest log output to file

git log --oneline -50 > log50_latest_commits.txt

Example 4: git log grep

git log --all --grep='Build 0051'

Example 5: gitlab push existing project commandlie

git config --global user.name "Roka Paudel,Sarmila S."