diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 8b13789..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ - diff --git a/History.md b/History.md index 10a3611..e04cf18 100644 --- a/History.md +++ b/History.md @@ -1,4 +1,13 @@ +0.0.8 / 2011-02-22 +================== + + * Added `git-create-branch`. + * Refactoring to adopt uniq code style across the scripts. + * git-release: Use annotated tags to release commits instead of lightweight tags. + * git-setup: Create a directory if the provided one doesn't exist yet. + * Fixed `git-ignore`: Don't fail if `.gitignore` file doesn't exist yet. + 0.4.1 / 2011-04-05 ================== @@ -33,79 +42,78 @@ 0.0.7 / 2010-10-31 ================== - * Added man pages [Jonhnny Weslley] - * Added `make clean` - * Added `make docs` - * Added -d -> -D. Closes #15 - * Added git-delete-submodule for delete submodules easily [Jonhnny Weslley] - * Added; `git-ignore` now shows the contents of _./.git-ignore_ if no args are present + * Added man pages. + * Added `make clean`. + * Added `make docs`. + * Added -d -> -D. Closes #15. + * Added git-delete-submodule for delete submodules easily. + * Added; `git-ignore` now shows the contents of _./.git-ignore_ if no args are present. 0.0.6 / 2010-10-22 ================== - * Added command `git-touch`. [Alex McHale] - * Use a shallow clone in `git-update-extras`. [Devin Withers] - * Create History.md if git-changelog can't find a target. Fixes #14. [Devin Withers] - * Bump version + * Added command `git-touch`. + * Use a shallow clone in `git-update-extras`. + * Create History.md if git-changelog can't find a target. Fixes #14. 0.0.5 / 2010-10-08 ================== - * Added `git-delete-submodule` [Jonhnny Weslley] - * Added; `git-ignore` without pattern shows .gitignore contents [Jonhnny Weslley] - * Added; `git-setup` argument is now optional, defaulting to the CWD - * Added REPL alias "ls" as ls-files + * Added `git-delete-submodule`. + * Added; `git-ignore` without pattern shows .gitignore contents. + * Added; `git-setup` argument is now optional, defaulting to the CWD. + * Added REPL alias "ls" as ls-files. 0.0.4 / 2010-09-10 ================== - * Added: `git-delete-branch`: Also delete the remote branch [Gert Van Gool] - * Added `git-summary` commitish support [Jonathan Leto] - * Added `git-graft` dest branch default of _master_ - * Added `git-setup` [Aggelos Orfanakos] - * Added `git-graft` [Kenneth Reitz] - * Added `git-undo` for removing recent commits. [Kenneth Reitz] - * Fixed `git-delete-branch`: Don't fail if the local branch doesn't exist [Gert Van Gool] - * Fixed __PREFIX__ to respect env vars - * Fixed shift in `git-count` + * Added: `git-delete-branch`: Also delete the remote branch. + * Added `git-summary` commitish support. + * Added `git-graft` dest branch default of _master_. + * Added `git-setup`. + * Added `git-graft`. + * Added `git-undo` for removing recent commits. + * Fixed `git-delete-branch`: Don't fail if the local branch doesn't exist. + * Fixed __PREFIX__ to respect env vars. + * Fixed shift in `git-count`. -0.0.3 / 2010-08-27 +0.0.3 / 2010-08-27 ================== - * Added `git-extras-version` - * Added `git-update-extras` - * Fixed `git-contrib` issue when the username is in a commit msg - * Fixed; delete remote tag only if local was deleted [Aggelos Orfanakos] - * Fixed; delete remote branch only if local was deleted [Aggelos Orfanakos] - * Fixed printing of authors for git-summary's on Ubuntu [jason young] - * Fixed; read doesn't have the -e option in SH on my machine at least. [Nick Campbell] + * Added `git-extras-version`. + * Added `git-update-extras`. + * Fixed `git-contrib` issue when the username is in a commit msg. + * Fixed: delete remote tag only if local was deleted. + * Fixed: delete remote branch only if local was deleted. + * Fixed printing of authors for git-summary's on Ubuntu. + * Fixed: read doesn't have the -e option in SH on my machine at least. 0.0.2 / 2010-08-24 ================== - * Added `git-summary` - * Added `git-commits-since` - * Added `git-repl` - * Added `git-delete-tag` - * Added `git-delete-branch` - * Added `git-contrib` - * Fixed handling off spaces in contributor's name for `git-contrib` [Domenico Rotiroti] - * Fixed spaces in `git-release` names/numbers [Domenico Rotiroti] - * Fixed readme + * Added `git-summary`. + * Added `git-commits-since`. + * Added `git-repl`. + * Added `git-delete-tag`. + * Added `git-delete-branch`. + * Added `git-contrib`. + * Fixed handling off spaces in contributor's name for `git-contrib`. + * Fixed spaces in `git-release` names/numbers. + * Fixed readme. 0.0.1 / 2010-08-05 ================== - * Docs for git-ignore. Closes #3 - * Merge branch 'ignore' - * Added git-ignore - * Readme typo - * Fixed in docs - * Install docs - * Merge branch 'release' - * Added git-release - * Fixed readme - * Readme - * Passing args to git shortlog - * Added --all support to git-count - * Initial commit + * Docs for `git-ignore`. Closes #3. + * Merge branch 'ignore'. + * Added `git-ignore`. + * Readme typo. + * Fixed in docs. + * Install docs. + * Merge branch 'release'. + * Added `git-release`. + * Fixed readme. + * Readme. + * Passing args to git shortlog. + * Added --all support to git-count. + * Initial commit. diff --git a/Readme.md b/Readme.md index 5aa2286..48d3145 100644 --- a/Readme.md +++ b/Readme.md @@ -25,11 +25,13 @@ Brew (buggy): - git commits-since - git pull-request - git count + - git create-branch - git delete-branch - git delete-submodule - git delete-tag - git fresh-branch - git graft + - git alias - git ignore - git release - git contrib @@ -99,28 +101,28 @@ Outputs a repo summary: $ git summary - project: express - commits: 1893 - files : 111 - authors: - 1285 visionmedia - 478 Tj Holowaychuk - 48 Aaron Heckmann - 34 csausdev - 26 ciaranj + project: express + commits: 1893 + files : 111 + authors: + 1285 visionmedia + 478 Tj Holowaychuk + 48 Aaron Heckmann + 34 csausdev + 26 ciaranj 6 Guillermo Rauch - 3 Nick Poulden - 2 Brian McKinney - 2 Benny Wong - 1 Justin Lilly - 1 James Herdman - 1 Adam Sanderson - 1 Viktor Kelemen - 1 Gregory Ritter - 1 Greg Ritter - 1 ewoudj - 1 isaacs - 1 Matt Colyer + 3 Nick Poulden + 2 Brian McKinney + 2 Benny Wong + 1 Justin Lilly + 1 James Herdman + 1 Adam Sanderson + 1 Viktor Kelemen + 1 Gregory Ritter + 1 Greg Ritter + 1 ewoudj + 1 isaacs + 1 Matt Colyer This command can also take a commitish, and will print a summary for the range of commits included in the commitish: @@ -132,7 +134,7 @@ of commits included in the commitish: GIT read-eval-print-loop: $ git repl - + git> ls-files History.md Makefile @@ -143,7 +145,7 @@ of commits included in the commitish: bin/git-delete-tag bin/git-ignore bin/git-release - + git> quit ## git-commits-since [date] @@ -197,15 +199,37 @@ of commits included in the commitish: ## git-release Release commit with the given <tag>. - + $ git release 0.1.0 - + Does the following: - Commits changes (to changelog etc) with message "Release <tag>" - Tags with the given <tag> - Pushes the branch / tags +## git-alias + + Define, search and show aliases. + + Defining a new alias: + + $ git alias last "cat-file commit HEAD" + + Providing only one argument, `git-alias` searchs for aliases matching the given value: + + $ git alias ^la + last = cat-file commit HEAD + + `git-alias` will show all aliases if no argument is given: + + $ git alias + s = status + amend = commit --amend + rank = shortlog -sn --no-merges + whatis = show -s --pretty='tformat:%h (%s, %ad)' --date=short + whois = !sh -c 'git log -i -1 --pretty="format:%an <%ae> + ## git-ignore To lazy to open up _.gitignore_? me too! simply pass some patterns: @@ -219,7 +243,13 @@ of commits included in the commitish: $ git ignore build *.o - *.log + *.log + +## git-create-branch <name> + + Creates local and remote branch _name_. + + $ git create-branch development ## git-delete-branch <name> @@ -258,10 +288,10 @@ of commits included in the commitish: since the previous tag or since the project began when no tags are present. Opens the changelog in **$EDITOR** when set. $ git changelog && cat History.md - - n.n.n / 2010-08-05 + + n.n.n / 2010-08-05 ================== - + * Docs for git-ignore. Closes #3 * Merge branch 'ignore' * Added git-ignore @@ -272,9 +302,9 @@ since the previous tag or since the project began when no tags are present. Open * Passing args to git shortlog * Added --all support to git-count * Initial commit - + Listing commits: - + $ git changelog --list * Docs for git-ignore. Closes #3 diff --git a/bin/git-alias b/bin/git-alias new file mode 100755 index 0000000..f3814d6 --- /dev/null +++ b/bin/git-alias @@ -0,0 +1,7 @@ +#!/bin/sh + +case $# in + 0) git config --get-regexp 'alias.*' | colrm 1 6 | sed 's/[ ]/ = /' | sort ;; + 1) git alias | grep -e "$1" ;; + *) git config --global "alias.$1" "$2" ;; +esac 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-create-branch b/bin/git-create-branch new file mode 100755 index 0000000..ca05dc4 --- /dev/null +++ b/bin/git-create-branch @@ -0,0 +1,9 @@ +#!/bin/sh + +branch=$1 +test -z $branch && echo "branch required." && exit 1 + +git push origin origin:refs/heads/$branch +git fetch origin +git checkout --track -b $branch origin/$branch +git pull 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 aed5728..83a5d20 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 +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-ignore b/bin/git-ignore index d7a6fed..625a9e6 100755 --- a/bin/git-ignore +++ b/bin/git-ignore @@ -1,7 +1,7 @@ #!/bin/sh if test $# -eq 0; then - cat .gitignore + test -f .gitignore && cat .gitignore else for pattern in $@; do echo $pattern >> .gitignore diff --git a/bin/git-release b/bin/git-release index 2be3b85..43264f2 100755 --- a/bin/git-release +++ b/bin/git-release @@ -1,12 +1,10 @@ #!/bin/sh -if test $# -gt 0; then - echo "... releasing $1" - git commit -a -m "Release $1" \ - && git tag "$1" \ - && git push \ - && git push --tags \ - && echo "... complete" -else - echo "tag required" && exit 1 -fi +tagname="$1" + +test -z "$tagname" && echo "tag required" && exit 1 + +echo "... releasing $tagname" +git tag -a "$tagname" -m "Release $tagname" \ + && git push --tags \ + && echo "... complete" diff --git a/bin/git-setup b/bin/git-setup index 5c58462..9916c7c 100755 --- a/bin/git-setup +++ b/bin/git-setup @@ -1,7 +1,8 @@ #!/bin/sh -dir=${1-.} -cd $dir \ +dir=$(test -z "$*" && echo "." || echo "$*") +mkdir -p "$dir" \ + && cd "$dir" \ && git init \ && git add . \ && git commit -m 'Initial commit' 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" diff --git a/man/git-alias.1 b/man/git-alias.1 new file mode 100644 index 0000000..b114d93 --- /dev/null +++ b/man/git-alias.1 @@ -0,0 +1,84 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "GIT\-ALIAS" "1" "March 2011" "" "Git Extras" +. +.SH "NAME" +\fBgit\-alias\fR \- Define, search and show aliases +. +.SH "SYNOPSIS" +\fBgit\-alias\fR [ ]|[] +. +.SH "DESCRIPTION" +. +.SH "OPTIONS" + +. +.P +The name of the alias to create\. +. +.P + +. +.P +The command for which you are creating an alias\. +. +.P + +. +.P +The pattern used for search aliases\. +. +.SH "EXAMPLES" +Defining a new alias: +. +.IP "" 4 +. +.nf + +$ git alias last "cat\-file commit HEAD" +. +.fi +. +.IP "" 0 +. +.P +Providing only one argument, \fBgit\-alias\fR searchs for aliases matching the given value: +. +.IP "" 4 +. +.nf + +$ git alias ^la +last = cat\-file commit HEAD +. +.fi +. +.IP "" 0 +. +.P +\fBgit\-alias\fR will show all aliases if no argument is given: +. +.IP "" 4 +. +.nf + +$ git alias +s = status +amend = commit \-\-amend +rank = shortlog \-sn \-\-no\-merges +whatis = show \-s \-\-pretty=\'tformat:%h (%s, %ad)\' \-\-date=short +whois = !sh \-c \'git log \-i \-1 \-\-pretty="format:%an <%ae> +. +.fi +. +.IP "" 0 +. +.SH "AUTHOR" +Written by Jonhnny Weslley <\fIjw@jonhnnyweslley\.net\fR> +. +.SH "REPORTING BUGS" +<\fIhttp://github\.com/visionmedia/git\-extras/issues\fR> +. +.SH "SEE ALSO" +<\fIhttp://github\.com/visionmedia/git\-extras\fR> diff --git a/man/git-alias.1.html b/man/git-alias.1.html new file mode 100644 index 0000000..50fc512 --- /dev/null +++ b/man/git-alias.1.html @@ -0,0 +1,141 @@ + + + + + + git-alias(1) - Define, search and show aliases + + + + +
+ + + +
    +
  1. git-alias(1)
  2. +
  3. Git Extras
  4. +
  5. git-alias(1)
  6. +
+ +

NAME

+

+ git-alias - Define, search and show aliases +

+ +

SYNOPSIS

+ +

git-alias [<alias-name> <command>]|[<search-term>]

+ +

DESCRIPTION

+ +

OPTIONS

+ +

<alias-name>

+ +

The name of the alias to create.

+ +

<command>

+ +

The command for which you are creating an alias.

+ +

<search-term>

+ +

The pattern used for search aliases.

+ +

EXAMPLES

+ +

Defining a new alias:

+ +
$ git alias last "cat-file commit HEAD"
+
+ +

Providing only one argument, git-alias searchs for aliases matching the given value:

+ +
$ git alias ^la
+last = cat-file commit HEAD
+
+ +

git-alias will show all aliases if no argument is given:

+ +
$ git alias
+s = status
+amend = commit --amend
+rank = shortlog -sn --no-merges
+whatis = show -s --pretty='tformat:%h (%s, %ad)' --date=short
+whois = !sh -c 'git log -i -1 --pretty="format:%an <%ae>
+
+ +

AUTHOR

+ +

Written by Jonhnny Weslley <jw@jonhnnyweslley.net>

+ +

REPORTING BUGS

+ +

<http://github.com/visionmedia/git-extras/issues>

+ +

SEE ALSO

+ +

<http://github.com/visionmedia/git-extras>

+ + +
    +
  1. +
  2. March 2011
  3. +
  4. git-alias(1)
  5. +
+ +
+ + diff --git a/man/git-alias.md b/man/git-alias.md new file mode 100644 index 0000000..010cd47 --- /dev/null +++ b/man/git-alias.md @@ -0,0 +1,56 @@ +git-alias(1) -- Define, search and show aliases +=============================================== + +## SYNOPSIS + +`git-alias` [<alias-name> <command>]|[<search-term>] + +## DESCRIPTION + + +## OPTIONS + + <alias-name> + + The name of the alias to create. + + <command> + + The command for which you are creating an alias. + + <search-term> + + The pattern used for search aliases. + + +## EXAMPLES + + Defining a new alias: + + $ git alias last "cat-file commit HEAD" + + Providing only one argument, `git-alias` searchs for aliases matching the given value: + + $ git alias ^la + last = cat-file commit HEAD + + `git-alias` will show all aliases if no argument is given: + + $ git alias + s = status + amend = commit --amend + rank = shortlog -sn --no-merges + whatis = show -s --pretty='tformat:%h (%s, %ad)' --date=short + whois = !sh -c 'git log -i -1 --pretty="format:%an <%ae> + +## AUTHOR + +Written by Jonhnny Weslley <> + +## REPORTING BUGS + +<> + +## SEE ALSO + +<> diff --git a/man/git-create-branch.1 b/man/git-create-branch.1 new file mode 100644 index 0000000..e321262 --- /dev/null +++ b/man/git-create-branch.1 @@ -0,0 +1,36 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "GIT\-CREATE\-BRANCH" "1" "February 2011" "" "Git Extras" +. +.SH "NAME" +\fBgit\-create\-branch\fR \- Create branches +. +.SH "SYNOPSIS" +\fBgit\-create\-branch\fR +. +.SH "DESCRIPTION" +Creates local and remote branch named \. +. +.SH "OPTIONS" + +. +.P +The name of the branch to create\. +. +.SH "EXAMPLES" +. +.nf + +$ git create\-branch integration +. +.fi +. +.SH "AUTHOR" +Written by Jonhnny Weslley <\fIjw@jonhnnyweslley\.net\fR> +. +.SH "REPORTING BUGS" +<\fIhttp://github\.com/visionmedia/git\-extras/issues\fR> +. +.SH "SEE ALSO" +<\fIhttp://github\.com/visionmedia/git\-extras\fR> diff --git a/man/git-create-branch.1.html b/man/git-create-branch.1.html new file mode 100644 index 0000000..78ff595 --- /dev/null +++ b/man/git-create-branch.1.html @@ -0,0 +1,117 @@ + + + + + + git-create-branch(1) - Create branches + + + + +
+ + + +
    +
  1. git-create-branch(1)
  2. +
  3. Git Extras
  4. +
  5. git-create-branch(1)
  6. +
+ +

NAME

+

+ git-create-branch - Create branches +

+ +

SYNOPSIS

+ +

git-create-branch <branchname>

+ +

DESCRIPTION

+ +

Creates local and remote branch named <branchname>.

+ +

OPTIONS

+ +

<branchname>

+ +

The name of the branch to create.

+ +

EXAMPLES

+ +
$ git create-branch integration
+
+ +

AUTHOR

+ +

Written by Jonhnny Weslley <jw@jonhnnyweslley.net>

+ +

REPORTING BUGS

+ +

<http://github.com/visionmedia/git-extras/issues>

+ +

SEE ALSO

+ +

<http://github.com/visionmedia/git-extras>

+ + +
    +
  1. +
  2. February 2011
  3. +
  4. git-create-branch(1)
  5. +
+ +
+ + diff --git a/man/git-create-branch.md b/man/git-create-branch.md new file mode 100644 index 0000000..b88ac9f --- /dev/null +++ b/man/git-create-branch.md @@ -0,0 +1,32 @@ +git-create-branch(1) -- Create branches +======================================= + +## SYNOPSIS + +`git-create-branch` <branchname> + +## DESCRIPTION + + Creates local and remote branch named <branchname>. + +## OPTIONS + + <branchname> + + The name of the branch to create. + +## EXAMPLES + + $ git create-branch integration + +## AUTHOR + +Written by Jonhnny Weslley <> + +## REPORTING BUGS + +<> + +## SEE ALSO + +<>