Last active
March 20, 2019 14:49
-
-
Save schollz/27b4ffe562b0b74bf8ee1e8055680d22 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Install into /usr/local/bin | |
# Make an entry using | |
# git-journal.sh | |
# Read the entries using | |
# git-journal.sh read | |
# | |
# Inspired by https://www.reddit.com/r/programming/comments/2951ma/jrnl_the_command_line_journal/ciif8jl/ | |
# Enjoy! | |
JOURNAL="${HOME}/.journal" | |
REPO="git@github.com:schollz/demo3.git" | |
GITOPTS="--git-dir=${JOURNAL} --work-tree=${JOURNAL}" | |
if [ ! -d "${JOURNAL}" ]; then | |
git init --quiet --bare --shared=0600 ${JOURNAL} && git $GITOPTS remote add origin ${REPO} | |
fi | |
git $GITOPTS pull origin master | |
if [ $# -eq 0 ]; then | |
git $GITOPTS commit --allow-empty --quiet | |
git $GITOPTS push origin master | |
else | |
git $GITOPTS log --pretty=tformat:'%Cgreen%ar %Cblue%s%Creset %b' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment