create-git-repo.sh: fix amend error if there's no branch checked out
In this case, `git commit --amend` fails. The state of a .git repo existing without a branch being checked out can be reached through the following sequence of events (which I just seem to have triggered): 1. The script calls `git init` 2. The user interrupts the script before `git commit` is finished
This commit is contained in:
parent
d9eecb7d4c
commit
67a573dae8
@ -4,7 +4,7 @@
|
||||
cd "$scriptDir/.."
|
||||
amend=--amend
|
||||
|
||||
if [[ ! -e .git ]]; then
|
||||
if [[ ! -e .git ]] || ! git rev-parse HEAD 2>/dev/null; then
|
||||
git init
|
||||
amend=
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user