Skip to content

Instantly share code, notes, and snippets.

@nirgeier
Last active February 11, 2016 10:20
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 nirgeier/83d56d9770bbc15ca288 to your computer and use it in GitHub Desktop.
Save nirgeier/83d56d9770bbc15ca288 to your computer and use it in GitHub Desktop.
Daily git tips Collection
#
# This file will contain the collection of git tips whic are posted here:
# https://www.facebook.com/groups/git.dvcs/
#
# -----------------------------------------
# 42
#
# Here we wil use the git log command to display all the local commits on any
# branch which has not pushed yet to the server
git log --branches --not --remotes --simplify-by-decoration --decorate --oneline
# Command breakdown:
#
# git log = print out the commit tree
# --branches --not --remotes = include only local branches in the output
# --simplify-by-decoration = Commits that are referred by some branch or tag are selected
# --decorate = Print out branch name, tags etc.
# --oneline = Compact mode - print summary on single line per commit
# -----------------------------------------
# 32 - How to print out list of all the branches with the last commit date + last commiter with cool colors
# You can change the for loop to display diffrent data like merged, unmerged, remote branches etc
#
for ref in $(git branch -a --merged origin/master); \
do git log -n1 $ref \
--pretty=format:"%Cgreen%an%Creset %C(yellow)%d%Creset %C(bold blue)%cr%Creset%n"; \
done | cat | sort -n -k1,1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment