Skip to content

Instantly share code, notes, and snippets.

View Faizanq's full-sized avatar

Faizan Qureshi Faizanq

View GitHub Profile
@salcode
salcode / bash-script-git.sh
Created September 5, 2015 19:54
Notes for bash scripting git commands
# Current branch - Determine current git branch, store in $currentbranch, and exit if not on a branch
if ! currentbranch=$(git symbolic-ref --short -q HEAD)
then
echo We are not currently on a branch.
exit 1
fi
# Uncommited Changes - Exit script if there uncommited changes
if ! git diff-index --quiet HEAD --; then
echo "There are uncommited changes on this repository."