Skip to content

Instantly share code, notes, and snippets.

@valllllll2000
Last active September 28, 2023 11:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save valllllll2000/224810c6f9bb0f6e6e41a31ac39d27d4 to your computer and use it in GitHub Desktop.
Save valllllll2000/224810c6f9bb0f6e6e41a31ac39d27d4 to your computer and use it in GitHub Desktop.
Useful git commands
#Pretty and comprehensive git log
# see https://git-scm.com/docs/git-log#_commit_formatting for options
git log --graph --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%an%C(reset)%C(bold yellow)%d%C(reset) %C(dim white)- %s%C(reset)' --all
#display stats about a commit
# see https://git-scm.com/docs/git-show
git show b1e7dcb0204d1eab337d0ff7b41a3e53441ed2bc --stat
#show changes for a file
git show <commit> -- <filepath>
#number of lines of code in a folder
git ls-files | xargs wc -l
# same a above but by filetype
git ls-files | grep '\.js' | xargs wc -l
#tags
git tag -a v1.4 -m "my version 1.4"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment