Skip to content

Instantly share code, notes, and snippets.

@jordifebrer
Last active March 16, 2022 15:10
Show Gist options
  • Save jordifebrer/fe3eebd49c0d1bcb26a6 to your computer and use it in GitHub Desktop.
Save jordifebrer/fe3eebd49c0d1bcb26a6 to your computer and use it in GitHub Desktop.
Some Git log commands

git log

Help!

git help log

Shows the list of commits (the most recent commits show up first)

git log

Shows the list of commits and the abbreviated stats

git log --stat

Shows the list of commits and the diff

git log -p

Same as above but limits the output to -n entries (2 in this example)

git log -p -2

Shows the list of commits on a single line

git log --pretty=oneline

Shows the list of formatted commits

git log --pretty=format:"%h - %an, %ar : %s"

Shows the list of formatted commits and a graph

git log --pretty=format:"%h %s" --graph

Shows all commits where commit message contains a given word

git log -p --grep=word_to_find
@mhimi22
Copy link

mhimi22 commented Mar 16, 2022

thanks bro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment