Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A script to log the last commit message to the users shared git log
#!/bin/bash
# A script to log the last commit message to the users shared git log
# Useful to keep track of what you did durring a specific day
LOG_PATH="$HOME/gitlogs"
DATE=`date +'%Y-%m-%d'`
COMMIT=`git log --color --graph --pretty=format:'%h %s' -1 HEAD`
REPO_PATH=`git rev-parse --show-toplevel`
REPO_NAME=`basename "$REPO_PATH"`
mkdir -p "$LOG_PATH"
echo "$REPO_NAME $COMMIT" >> "$LOG_PATH"/"$DATE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.