From fac85e1a768629698919e1cabe1945749658521d Mon Sep 17 00:00:00 2001 From: Jonhnny Weslley Date: Tue, 9 Nov 2010 10:10:01 -0300 Subject: [PATCH 01/14] git-ignore doesnt fail if .gitignore file dont exists yet --- bin/git-ignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From deadcd64a5ca08bf05c57d76080b4db9c724d861 Mon Sep 17 00:00:00 2001 From: Jonhnny Weslley Date: Tue, 9 Nov 2010 12:03:31 -0300 Subject: [PATCH 02/14] git-ignore template support. Templates are based in https://github.com/github/gitignore --- .gitmodules | 3 +++ Readme.md | 3 +++ bin/git-ignore | 20 +++++++++++++++++++- etc/gitignore | 1 + 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 .gitmodules create mode 160000 etc/gitignore diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..bfa6d33 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "etc/gitignore"] + path = etc/gitignore + url = git://github.com/github/gitignore.git diff --git a/Readme.md b/Readme.md index f2facca..1ad8c79 100644 --- a/Readme.md +++ b/Readme.md @@ -178,6 +178,9 @@ of commits included in the commitish: *.o *.log + Adding patterns from an existing template: + $ git ignore -t rails + ## git-delete-branch <name> Deletes local and remote branch _name_. diff --git a/bin/git-ignore b/bin/git-ignore index 625a9e6..47f084a 100755 --- a/bin/git-ignore +++ b/bin/git-ignore @@ -1,7 +1,25 @@ #!/bin/sh +template="" +while getopts "t:" opt; do + case "$opt" in + t) template=$OPTARG;shift;shift;; + esac +done + +if [ ! -z "$template" ]; then + gitignoredir="`dirname $0`/../etc/gitignore" + selected_template=$(find $gitignoredir -type f -name *.gitignore | xargs -i basename {} .gitignore | grep -i $template) + count=$(echo $selected_template | wc -w) + case "$count" in + 0) echo "The pattern '$template' does not match any available templates." && exit 1;; + 1) find $gitignoredir -name $selected_template.gitignore -exec cat {} \; >> .gitignore && echo "... added patterns from template '$selected_template'";; + *) echo "Be more specific. $count macthes found:\n$selected_template" && exit 2;; + esac +fi + if test $# -eq 0; then - test -f .gitignore && cat .gitignore + test -z $template && test -f .gitignore && cat .gitignore else for pattern in $@; do echo $pattern >> .gitignore diff --git a/etc/gitignore b/etc/gitignore new file mode 160000 index 0000000..0a41318 --- /dev/null +++ b/etc/gitignore @@ -0,0 +1 @@ +Subproject commit 0a41318dba7094f7f97646280a0096e30b6cd596 From fcf8a696c6beef703ceb755161ff7eab992e0781 Mon Sep 17 00:00:00 2001 From: Jonhnny Weslley Date: Wed, 10 Nov 2010 12:22:49 -0300 Subject: [PATCH 03/14] Fixes multiple matches selection --- bin/git-ignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/git-ignore b/bin/git-ignore index 47f084a..fbc159c 100755 --- a/bin/git-ignore +++ b/bin/git-ignore @@ -9,7 +9,7 @@ done if [ ! -z "$template" ]; then gitignoredir="`dirname $0`/../etc/gitignore" - selected_template=$(find $gitignoredir -type f -name *.gitignore | xargs -i basename {} .gitignore | grep -i $template) + selected_template=$(find $gitignoredir -type f -name *.gitignore | xargs -i basename {} .gitignore | sort | grep $template) count=$(echo $selected_template | wc -w) case "$count" in 0) echo "The pattern '$template' does not match any available templates." && exit 1;; From 3ed8d50f5c52bd8424e707e99bfcc5785129b8a2 Mon Sep 17 00:00:00 2001 From: Jonhnny Weslley Date: Wed, 10 Nov 2010 14:52:18 -0300 Subject: [PATCH 04/14] improved user feedback: show matched string using 'grep --color' --- bin/git-ignore | 10 ++++++---- etc/gitignore | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/bin/git-ignore b/bin/git-ignore index fbc159c..4c23546 100755 --- a/bin/git-ignore +++ b/bin/git-ignore @@ -9,12 +9,14 @@ done if [ ! -z "$template" ]; then gitignoredir="`dirname $0`/../etc/gitignore" - selected_template=$(find $gitignoredir -type f -name *.gitignore | xargs -i basename {} .gitignore | sort | grep $template) - count=$(echo $selected_template | wc -w) + selected_template() { + find $gitignoredir -type f -name *.gitignore | xargs -i basename {} .gitignore | sort | grep $template + } + count=$(selected_template | wc -w) case "$count" in 0) echo "The pattern '$template' does not match any available templates." && exit 1;; - 1) find $gitignoredir -name $selected_template.gitignore -exec cat {} \; >> .gitignore && echo "... added patterns from template '$selected_template'";; - *) echo "Be more specific. $count macthes found:\n$selected_template" && exit 2;; + 1) find $gitignoredir -name $(selected_template).gitignore -exec cat {} \; >> .gitignore && echo "... added patterns from template '$(selected_template)'";; + *) echo "Be more specific. $count macthes found:" && selected_template | grep --color $template && exit 2;; esac fi diff --git a/etc/gitignore b/etc/gitignore index 0a41318..acbcdb0 160000 --- a/etc/gitignore +++ b/etc/gitignore @@ -1 +1 @@ -Subproject commit 0a41318dba7094f7f97646280a0096e30b6cd596 +Subproject commit acbcdb02e5e608cfd1c9a93eba67c6a73d632870 From c909df34fcdd65262541d97957af8a364ee000f2 Mon Sep 17 00:00:00 2001 From: Jonhnny Weslley Date: Wed, 10 Nov 2010 15:03:19 -0300 Subject: [PATCH 05/14] git-ignore: show all availables templates if no patterns are found. --- bin/git-ignore | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/git-ignore b/bin/git-ignore index 4c23546..a117fd6 100755 --- a/bin/git-ignore +++ b/bin/git-ignore @@ -9,12 +9,15 @@ done if [ ! -z "$template" ]; then gitignoredir="`dirname $0`/../etc/gitignore" + available_templates() { + find $gitignoredir -type f -name *.gitignore | xargs -i basename {} .gitignore | sort + } selected_template() { - find $gitignoredir -type f -name *.gitignore | xargs -i basename {} .gitignore | sort | grep $template + available_templates | grep $template } count=$(selected_template | wc -w) case "$count" in - 0) echo "The pattern '$template' does not match any available templates." && exit 1;; + 0) echo "The pattern '$template' does not match any available templates." && available_templates | less && exit 1;; 1) find $gitignoredir -name $(selected_template).gitignore -exec cat {} \; >> .gitignore && echo "... added patterns from template '$(selected_template)'";; *) echo "Be more specific. $count macthes found:" && selected_template | grep --color $template && exit 2;; esac From a14e95a7275e9584ffa3fe25924f424bb905f0df Mon Sep 17 00:00:00 2001 From: Jonhnny Weslley Date: Wed, 10 Nov 2010 16:26:26 -0300 Subject: [PATCH 06/14] git-setup: create a directory if the provided one does not exist yet. Additionally, enables the creation of directories with names containing spaces in a more fashion way. Example: 'git setup path/to/repo name'. --- bin/git-setup | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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' From 54fd21a755247fbb230c456ea34f63ccfa88ef89 Mon Sep 17 00:00:00 2001 From: Jonhnny Weslley Date: Wed, 24 Nov 2010 10:16:53 -0300 Subject: [PATCH 07/14] Use annotated tags to release commits instead of lightweight tags --- bin/git-release | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/bin/git-release b/bin/git-release index 2be3b85..91fe9fd 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 $1" +git tag -a "$1" -m "Release $1" \ + && git push --tags \ + && echo "... complete" From 729b231f21aef2f2e3b1d0b4e346c7346d0c686b Mon Sep 17 00:00:00 2001 From: Jonhnny Weslley Date: Wed, 24 Nov 2010 10:17:34 -0300 Subject: [PATCH 08/14] fixed typo error --- bin/git-ignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/git-ignore b/bin/git-ignore index a117fd6..c3ab6a4 100755 --- a/bin/git-ignore +++ b/bin/git-ignore @@ -19,7 +19,7 @@ if [ ! -z "$template" ]; then case "$count" in 0) echo "The pattern '$template' does not match any available templates." && available_templates | less && exit 1;; 1) find $gitignoredir -name $(selected_template).gitignore -exec cat {} \; >> .gitignore && echo "... added patterns from template '$(selected_template)'";; - *) echo "Be more specific. $count macthes found:" && selected_template | grep --color $template && exit 2;; + *) echo "Be more specific. $count matches found:" && selected_template | grep --color $template && exit 2;; esac fi From f235670a3e1998f61c2661a3960edab5a6d3487d Mon Sep 17 00:00:00 2001 From: Jonhnny Weslley Date: Thu, 25 Nov 2010 16:23:38 -0300 Subject: [PATCH 09/14] adopting uniq code style across multiple scripts: variables assignments, arguments validation and core logic. This style reduces if statements usage and makes code easier to understand. :D --- .gitignore | 1 - bin/git-contrib | 15 +++++++-------- bin/git-delete-branch | 7 ++++--- bin/git-delete-submodule | 6 ++++-- bin/git-delete-tag | 5 +++-- bin/git-fresh-branch | 9 ++++++--- bin/git-graft | 5 +++-- bin/git-release | 8 ++++---- bin/git-touch | 8 ++++---- 9 files changed, 35 insertions(+), 29 deletions(-) delete mode 100644 .gitignore 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" From 1a1a722527c2ce6a8ace890ade1e73be35c26b9d Mon Sep 17 00:00:00 2001 From: Jonhnny Weslley Date: Tue, 22 Feb 2011 13:07:41 -0300 Subject: [PATCH 10/14] removed git-ignore template support --- .gitmodules | 3 --- bin/git-ignore | 25 +------------------------ etc/gitignore | 1 - 3 files changed, 1 insertion(+), 28 deletions(-) delete mode 100644 .gitmodules delete mode 160000 etc/gitignore diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index bfa6d33..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "etc/gitignore"] - path = etc/gitignore - url = git://github.com/github/gitignore.git diff --git a/bin/git-ignore b/bin/git-ignore index c3ab6a4..625a9e6 100755 --- a/bin/git-ignore +++ b/bin/git-ignore @@ -1,30 +1,7 @@ #!/bin/sh -template="" -while getopts "t:" opt; do - case "$opt" in - t) template=$OPTARG;shift;shift;; - esac -done - -if [ ! -z "$template" ]; then - gitignoredir="`dirname $0`/../etc/gitignore" - available_templates() { - find $gitignoredir -type f -name *.gitignore | xargs -i basename {} .gitignore | sort - } - selected_template() { - available_templates | grep $template - } - count=$(selected_template | wc -w) - case "$count" in - 0) echo "The pattern '$template' does not match any available templates." && available_templates | less && exit 1;; - 1) find $gitignoredir -name $(selected_template).gitignore -exec cat {} \; >> .gitignore && echo "... added patterns from template '$(selected_template)'";; - *) echo "Be more specific. $count matches found:" && selected_template | grep --color $template && exit 2;; - esac -fi - if test $# -eq 0; then - test -z $template && test -f .gitignore && cat .gitignore + test -f .gitignore && cat .gitignore else for pattern in $@; do echo $pattern >> .gitignore diff --git a/etc/gitignore b/etc/gitignore deleted file mode 160000 index acbcdb0..0000000 --- a/etc/gitignore +++ /dev/null @@ -1 +0,0 @@ -Subproject commit acbcdb02e5e608cfd1c9a93eba67c6a73d632870 From b74a9d7080fbf5e79105fd546e248baad3670617 Mon Sep 17 00:00:00 2001 From: Jonhnny Weslley Date: Tue, 22 Feb 2011 16:53:51 -0300 Subject: [PATCH 11/14] Added git-create-branch --- History.md | 114 ++++++++++++++++++---------------- Readme.md | 8 ++- bin/git-create-branch | 9 +++ man/git-create-branch.1 | 36 +++++++++++ man/git-create-branch.1.html | 117 +++++++++++++++++++++++++++++++++++ man/git-create-branch.md | 32 ++++++++++ 6 files changed, 261 insertions(+), 55 deletions(-) create mode 100755 bin/git-create-branch create mode 100644 man/git-create-branch.1 create mode 100644 man/git-create-branch.1.html create mode 100644 man/git-create-branch.md diff --git a/History.md b/History.md index 3bd3ea4..0acacba 100644 --- a/History.md +++ b/History.md @@ -1,80 +1,88 @@ +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.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 5eed3ed..30259f2 100644 --- a/Readme.md +++ b/Readme.md @@ -23,6 +23,7 @@ Brew (buggy): - git changelog - git commits-since - git count + - git create-branch - git delete-branch - git delete-submodule - git delete-tag @@ -178,8 +179,11 @@ of commits included in the commitish: *.o *.log - Adding patterns from an existing template: - $ git ignore -t rails +## git-create-branch <name> + + Creates local and remote branch _name_. + + $ git create-branch development ## git-delete-branch <name> 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/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 + +<> From 8f9a69a96975fa677b4518740b051fd00ff008f5 Mon Sep 17 00:00:00 2001 From: Jonhnny Weslley Date: Tue, 22 Feb 2011 17:12:39 -0300 Subject: [PATCH 12/14] Bump version --- bin/git-extras-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/git-extras-version b/bin/git-extras-version index 130494f..154079b 100755 --- a/bin/git-extras-version +++ b/bin/git-extras-version @@ -1,2 +1,2 @@ #!/bin/sh -echo "0.0.7" \ No newline at end of file +echo "0.0.8" From f3fb2dda61e6fba96bb6c291e550ca97a05df892 Mon Sep 17 00:00:00 2001 From: Jonhnny Weslley Date: Tue, 15 Mar 2011 23:13:07 -0300 Subject: [PATCH 13/14] git alias --- bin/git-alias | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100755 bin/git-alias 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 From ae511e0ef0e9adad859a1f23e3cca745b72fc1e1 Mon Sep 17 00:00:00 2001 From: Jonhnny Weslley Date: Wed, 16 Mar 2011 15:58:27 -0300 Subject: [PATCH 14/14] documentation for git-alias --- Readme.md | 85 ++++++++++++++++---------- man/git-alias.1 | 84 ++++++++++++++++++++++++++ man/git-alias.1.html | 141 +++++++++++++++++++++++++++++++++++++++++++ man/git-alias.md | 56 +++++++++++++++++ 4 files changed, 335 insertions(+), 31 deletions(-) create mode 100644 man/git-alias.1 create mode 100644 man/git-alias.1.html create mode 100644 man/git-alias.md diff --git a/Readme.md b/Readme.md index 30259f2..e39320a 100644 --- a/Readme.md +++ b/Readme.md @@ -29,6 +29,7 @@ Brew (buggy): - git delete-tag - git fresh-branch - git graft + - git alias - git ignore - git release - git contrib @@ -57,28 +58,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: @@ -90,7 +91,7 @@ of commits included in the commitish: GIT read-eval-print-loop: $ git repl - + git> ls-files History.md Makefile @@ -101,7 +102,7 @@ of commits included in the commitish: bin/git-delete-tag bin/git-ignore bin/git-release - + git> quit ## git-commits-since [date] @@ -155,15 +156,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: @@ -177,7 +200,7 @@ of commits included in the commitish: $ git ignore build *.o - *.log + *.log ## git-create-branch <name> @@ -222,10 +245,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 @@ -236,9 +259,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/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 + +<>