git-setup argument is now optional, defaulting to the CWD

This commit is contained in:
Tj Holowaychuk 2010-09-14 14:52:41 -07:00
parent 938bf5420f
commit 1b5d9890f9
2 changed files with 7 additions and 6 deletions

View file

@ -242,6 +242,6 @@ Remove the latest 3 commits:
Updates git extras. clones the repo to _/tmp/git-extras_, make installs, then cds back to the origin directory.
## git-setup
## git-setup [dir]
Set up a git repository if one doesn't exist, add all files and make an initial commit.
Set up a git repository if one doesn't exist, add all files and make an initial commit. _dir_ defaults to the current working directory.

View file

@ -1,6 +1,7 @@
#!/bin/sh
test -z "$1" && echo "path required." && exit 1
cd "$1"
test -d .git && exit
git init && git add . && git commit -m 'Initial commit'
dir=${1-.}
cd $dir \
&& git init \
&& git add . \
&& git commit -m 'Initial commit'