Skip to content

Instantly share code, notes, and snippets.

@erkarp
Last active June 16, 2016 13:42
Show Gist options
  • Save erkarp/73137d51d38562160ae0 to your computer and use it in GitHub Desktop.
Save erkarp/73137d51d38562160ae0 to your computer and use it in GitHub Desktop.
Bash functions to format git log
gitlog() {
c="git log --all --decorate --graph --pretty=format:%C(Yellow)%h%Creset_%Cred%cd%Creset_%Cblue%s%Creset%C(magenta)%d%Creset --date=local"
$c
}
# Use function 'datecode' (with optional date arg yyyy-mm-dd)
datestamp() {
date +"%Y-%m-%d"
}
datecode() {
if [[ $1 =~ [0-9] ]]
then
echo "--after='$1 00:00' --before='23:59'"
else
echo $1
echo "--after='$(datestamp) 00'"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment