Git Todo

After reading Brett Terpstra’s na: Per-Project Todos in Terminal I decide to implement something similar but for my git repos and much more minimal. So I added a quick Bash function to always open TODO.taskpaper in vim (at the base of my git repo). This way I don’t have to worry about how many ../ to include, etc. Just git-todo and done. If you use TaskPaper and vim then get taskpaper.vim

function git-todo {
    OS=$(uname -s)
    if [ "$OS" == "Darwin" ]; then
        SED_OPT="-E"
    fi
    if [ "$OS" == "Linux" ]; then
        SED_OPT="-r"
    fi
    GIT_DIR=$(git rev-parse --git-dir)
    if ! (( $? )); then
        GIT_DIR=$(echo "$GIT_DIR" | sed $SED_OPT 's/\/?\.git$//')
        if [ -z "$GIT_DIR" ]; then
            GIT_DIR=.
        fi
        vim $GIT_DIR/TODO.taskpaper
    fi
}

Also on GitHub, .bashrc.d/git.sh.