Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@aereal
Created January 29, 2016 13:12
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 aereal/64d4a1319763f8658ede to your computer and use it in GitHub Desktop.
Save aereal/64d4a1319763f8658ede to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
repo_sig=$1
repos_root="$(ghq root)"
repo_path="${repos_root}/${repo_sig}"
if [[ ! -d "$repo_path/.git" ]]; then
echo "! ${repo_path} is not a Git repository" >&2
exit 1
fi
if git -C $repo_path rev-parse '@{u}' >/dev/null 2>&1; then
if [[ "$(git -C $repo_path rev-list --left-only --count '...@{u}')" -ne 0 ]]; then
echo "! ${repo_path} has changes" >&2
exit 1
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment