Skip to content

Instantly share code, notes, and snippets.

@TeaDrivenDev
Created May 10, 2017
Embed
What would you like to do?
Shell script that runs the given Git command and then `git status` except for certain cases where it's not useful
#!/bin/sh
args=("$@")
git "$@"
if [ $# -gt 0 ]
then
first=${args[0]}
if ([ -d .git ] | git rev-parse --git-dir > /dev/null 2>&1) && \
[ ${first} != "help" ] && \
[ ${first} != "status" ] && \
[ ${first} != "log" ] && \
([[ ${first} != "stash" ]] || [[ ${args[1]} != "pop" ]] && [[ ${args[1]} != "apply" ]])
then
git status
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment