From 7e341e3b1ff5f631a54ad291722eabbbe23d3ca4 Mon Sep 17 00:00:00 2001 From: Semisol Date: Tue, 17 Aug 2021 12:52:14 +0300 Subject: [PATCH] Add a check for being a git repo --- git-force | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/git-force b/git-force index ce495d1..a7af5a6 100755 --- a/git-force +++ b/git-force @@ -7,6 +7,12 @@ then echo " git force " exit 0 fi +git rev-parse --is-inside-work-tree > /dev/null 2>&1 +if [[ "$?" != "0" ]] +then +echo "error: not a git repository" +exit 10 +fi REMOTE="" BRANCH="" PRETTY="--pretty=format:%h, %an <%ae>, %cr: %s"