mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 07:26:17 -04:00
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
This commit is contained in:
parent
a55cc84a11
commit
2b6e35d5eb
|
|
@ -1,8 +1,16 @@
|
|||
#!/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'
|
||||
|
|
|
|||
Loading…
Reference in a new issue