diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 8b13789..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ - diff --git a/bin/git-contrib b/bin/git-contrib index 6767551..23c130e 100755 --- a/bin/git-contrib +++ b/bin/git-contrib @@ -1,10 +1,9 @@ #!/bin/sh -user="$1" -if test -z "$user"; then - echo "user name required." && exit 1 -else - count=`git log --oneline --pretty="format: %an" | grep "$user" | wc -l` - test $count -eq 0 && echo "$user did not contribute." && exit 1 - git shortlog | grep "$user (" -A $count -fi \ No newline at end of file +user="$*" + +test -z "$user" && echo "user name required." && exit 1 + +count=`git log --oneline --pretty="format: %an" | grep "$user" | wc -l` +test $count -eq 0 && echo "$user did not contribute." && exit 1 +git shortlog | grep "$user (" -A $count diff --git a/bin/git-delete-branch b/bin/git-delete-branch index f8dcdfd..78f62cb 100755 --- a/bin/git-delete-branch +++ b/bin/git-delete-branch @@ -1,5 +1,6 @@ #!/bin/sh -test -z $1 && echo "branch required." && exit 1 -git branch -D $1 -git branch -d -r origin/$1 && git push origin :$1 +branch=$1 +test -z $branch && echo "branch required." && exit 1 +git branch -D $branch +git branch -d -r origin/$branch && git push origin :$branch diff --git a/bin/git-delete-submodule b/bin/git-delete-submodule index ceb1fa9..8b80e35 100755 --- a/bin/git-delete-submodule +++ b/bin/git-delete-submodule @@ -1,9 +1,11 @@ #!/bin/sh -test -z $1 && echo "submodule required" && exit 1 +submodule=$1 + +test -z $submodule && echo "submodule required" && exit 1 test ! -f .gitmodules && echo ".gitmodules file not found" && exit 2 -NAME=$(echo $1 | sed 's/\/$//g') +NAME=$(echo $submodule | sed 's/\/$//g') test -z $(git config --file=.gitmodules submodule.$NAME.url) && echo "submodule not found" && exit 3 git config --remove-section submodule.$NAME diff --git a/bin/git-delete-tag b/bin/git-delete-tag index ac9e8eb..470e378 100755 --- a/bin/git-delete-tag +++ b/bin/git-delete-tag @@ -1,4 +1,5 @@ #!/bin/sh -test -z $1 && echo "tag required." && exit 1 -git tag -d $1 && git push origin :refs/tags/$1 \ No newline at end of file +tagname=$1 +test -z $tagname && echo "tag required." && exit 1 +git tag -d $tagname && git push origin :refs/tags/$tagname diff --git a/bin/git-fresh-branch b/bin/git-fresh-branch index 9952e49..e8dd7e0 100755 --- a/bin/git-fresh-branch +++ b/bin/git-fresh-branch @@ -1,6 +1,9 @@ #!/bin/sh -test -z $1 && echo "branch required." && exit 1 -git symbolic-ref HEAD refs/heads/$1 +branch=$1 + +test -z $branch && echo "branch required." && exit 1 + +git symbolic-ref HEAD refs/heads/$branch rm .git/index -git clean -fdx \ No newline at end of file +git clean -fdx diff --git a/bin/git-graft b/bin/git-graft index ad212f7..a95a823 100755 --- a/bin/git-graft +++ b/bin/git-graft @@ -1,9 +1,10 @@ #!/bin/sh -test -z $1 && echo "source branch required." && exit 1 src=$1 dst=${2-master} +test -z $src && echo "source branch required." && exit 1 + git checkout $dst \ && git merge --no-ff $src \ - && git branch -d $src \ No newline at end of file + && git branch -d $src diff --git a/bin/git-release b/bin/git-release index 91fe9fd..43264f2 100755 --- a/bin/git-release +++ b/bin/git-release @@ -1,10 +1,10 @@ #!/bin/sh -tagname=$1 +tagname="$1" -test -z $tagname && echo "tag required" && exit 1 +test -z "$tagname" && echo "tag required" && exit 1 -echo "... releasing $1" -git tag -a "$1" -m "Release $1" \ +echo "... releasing $tagname" +git tag -a "$tagname" -m "Release $tagname" \ && git push --tags \ && echo "... complete" diff --git a/bin/git-touch b/bin/git-touch index 30e65ad..42c1cf3 100755 --- a/bin/git-touch +++ b/bin/git-touch @@ -1,8 +1,8 @@ #!/bin/sh -filename=$1 +filename="$*" -test -z $filename && echo "filename required" && exit 1 +test -z "$filename" && echo "filename required" && exit 1 -touch $filename \ - && git add $filename +touch "$filename" \ + && git add "$filename"