williamthorsen/git-recon

feat: Guard against use outside of a Git repo

Closed this issue · 1 comments

Running a Git-Recon alias outside of a Git repo can result in a large number of error messages, because some aliases use multiple Git commands, all of which will fail.

Add a guard such as this one:

if ! git rev-parse --is-inside-work-tree > /dev/null 2>&1; then
  echo "Error: This command must be run within a Git repository."
  exit 1
fi