diff --git a/Readme.md b/Readme.md index ebb41f9..69a8c10 100644 --- a/Readme.md +++ b/Readme.md @@ -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. diff --git a/bin/git-setup b/bin/git-setup index 0320523..5c58462 100755 --- a/bin/git-setup +++ b/bin/git-setup @@ -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'