Skip to content

Instantly share code, notes, and snippets.

@baalexander
Last active September 24, 2015 15:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baalexander/767319 to your computer and use it in GitHub Desktop.
Save baalexander/767319 to your computer and use it in GitHub Desktop.
Useful git commands
# Sorts users by number of commits
# Example output:
# 85 baalexander
# 59 elaw
# 58 jsmartt
# See https://github.com/blog/766-jeff-king-peff-is-a-githubber
git log --pretty=format:%aN | sort | uniq -c | sort -rn
# Alternative
git shortlog -sn
# Shows the commit history in graph form
# Example output:
# * 9d50ef6 - Moved logic from template to preprocess for All Deals fields view. (16 hours ago) <baalexander>
# See http://www.jukie.net/bart/blog/pimping-out-git-log
git log --graph --pretty=format:'%Cred%h%Creset -%C(bold blue)%d%Creset %C(yellow)%an%Creset %s %Cgreen(%cr)' --abbrev-commit --date=relative
# Dry run for removing untracked files and empty directories
git clean -dn .
# Removes untracked files and empty directories
git clean -df .
# Tagging
git tag -a v1.0 -m 'Your description here'
git push origin --tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment