tj.git-extras/bin/git-setup
Adam Parkin 2b6e35d5eb Address issue #190, git-setup should test for existing .git in target directory
- now exits with an error message if the target directory already has a .git directory
2013-10-01 13:26:55 -07:00

17 lines
303 B
Bash
Executable file

#!/bin/sh
gitdirexists(){
if [ -d ".git" ]; then
echo ".git directory already exists, aborting"
exit 1
fi
}
dir=$(test -z "$*" && echo "." || echo "$*")
mkdir -p "$dir" \
&& cd "$dir" \
&& gitdirexists \
&& git init \
&& git add . \
&& git commit -m 'Initial commit'