Skip to content

Instantly share code, notes, and snippets.

@TeaDrivenDev
Created May 10, 2017 21:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TeaDrivenDev/5244fe6811bf21a39492f4f5e192dc0a to your computer and use it in GitHub Desktop.
Save TeaDrivenDev/5244fe6811bf21a39492f4f5e192dc0a to your computer and use it in GitHub Desktop.
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