diff --git a/History.md b/History.md index 0acacba..e04cf18 100644 --- a/History.md +++ b/History.md @@ -8,6 +8,37 @@ * 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 +================== + + * Changed; `git-graft` now defaults to current branch instead of master [Kenneth Reitz] + +0.4.0 / 2011-04-05 +================== + + * Added `git-refactor` + * Added `git-bug` + * Added `git-feature` + +0.3.0 / 2011-03-29 +================== + + * Added `git-pull-request` + +0.2.0 / 2011-03-27 +================== + + * Added `git-extras` + * Added __LICENSE__ + * Removed `git-extras-version`, use `git extras --version` + * Removed `git-extras-update`, use `git extras update` + * Changed; make sure to get the last chronological tag, instead of relying on the bogus `git tag` sorting. [guillermo] + +0.1.0 / 2011-02-10 +================== + + * Added `gh-pages` command + 0.0.7 / 2010-10-31 ================== diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b35b32b --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2010-2011 TJ Holowaychuk + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/Makefile b/Makefile index 4889096..d41fa3d 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,7 @@ MAN_PAGES = $(MANS:.md=.1) install: @mkdir -p $(MANPREFIX) + @mkdir -p $(PREFIX)/bin @echo "... installing bins to $(PREFIX)/bin" @echo "... installing man pages to $(MANPREFIX)" @$(foreach BIN, $(BINS), \ diff --git a/Readme.md b/Readme.md index e39320a..48d3145 100644 --- a/Readme.md +++ b/Readme.md @@ -19,9 +19,11 @@ Brew (buggy): ## Commands + - git extras - git summary - git changelog - git commits-since + - git pull-request - git count - git create-branch - git delete-branch @@ -35,9 +37,50 @@ Brew (buggy): - git contrib - git repl - git undo - - git update-extras + - git gh-pages - git setup - git touch + - git feature + - git refactor + - git bug + +## extras + + The main `git-extras` command, outputting the current `--version`, or listing the commands available via `--help`, or `updating` to the latest release. + +For example if you wish to update to the latest version of git-extras simply execute: + + $ git extras update + +## gh-pages + + Sets up the `gh-pages` branch. + +## git-[feature|refactor|bug] [finish] <name> + + Creates the given feature, refactor, or bug branch `name`: + + $ git feature dependencies + + Later we can check it out by issuing the same command: + + $ git checkout master + $ git feature dependencies + + Finally when finished, we can add `finish`, merging it into the current branch: + + $ git checkout master + $ git feature finish dependencies + + `feature` can be replaced with `bug`, or `refactor`. + +## git-pull-request <number> + + Pulls the given request `number` from github, and applies it + via `git am`. The git config `github.user` must be present, and + the dirname must map to `https://github.com//` + + git pull-request 604 ## git-contrib @@ -286,10 +329,6 @@ Remove the latest 3 commits: git undo 3 -## git-update-extras - - Updates git extras. clones the repo to _/tmp/git-extras_, make installs, then cds back to the origin directory. - ## git-setup [dir] 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-bug b/bin/git-bug new file mode 100755 index 0000000..c86adc0 --- /dev/null +++ b/bin/git-bug @@ -0,0 +1,12 @@ +#!/bin/sh + +if test "$1" = "finish"; then + test -z $2 && echo "bug required." && exit 1 + branch=bug/$2 + git merge --no-ff $branch && git delete-branch $branch +else + test -z $1 && echo "bug required." && exit 1 + branch=bug/$1 + git checkout -b $branch &> /dev/null + git checkout $branch &> /dev/null +fi \ No newline at end of file diff --git a/bin/git-changelog b/bin/git-changelog index 5ce5880..c7c390c 100755 --- a/bin/git-changelog +++ b/bin/git-changelog @@ -6,7 +6,8 @@ DATE=`date +'%Y-%m-%d'` HEAD="\nn.n.n / $DATE \n==================\n" if test "$1" = "--list"; then - version=`git tag | tail -n 1` + version=`git for-each-ref refs/tags --sort=-authordate --format='%(refname)' \ + --count=1 | sed 's/^refs\/tags\///'` if test -z "$version"; then git log --pretty="format: * %s" else @@ -20,4 +21,4 @@ else if [ -f $CHANGELOG ]; then cat $CHANGELOG >> $tmp; fi mv $tmp $CHANGELOG test -n "$EDITOR" && $EDITOR $CHANGELOG -fi \ No newline at end of file +fi diff --git a/bin/git-extras b/bin/git-extras new file mode 100755 index 0000000..5f436c2 --- /dev/null +++ b/bin/git-extras @@ -0,0 +1,20 @@ +#!/bin/sh + +VERSION="0.4.1" + +update() { + local orig=$PWD + cd /tmp \ + && rm -fr ./git-extras \ + && git clone --depth 1 http://github.com/visionmedia/git-extras.git \ + && cd git-extras \ + && make install \ + && cd $orig \ + && echo "... updated git-extras $VERSION -> $(git extras --version)" +} + +case "$1" in + -v|--version) echo $VERSION && exit 0 ;; + update) update ;; + *) man git-extras ;; +esac \ No newline at end of file diff --git a/bin/git-extras-version b/bin/git-extras-version deleted file mode 100755 index 154079b..0000000 --- a/bin/git-extras-version +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -echo "0.0.8" diff --git a/bin/git-feature b/bin/git-feature new file mode 100755 index 0000000..42e6b3a --- /dev/null +++ b/bin/git-feature @@ -0,0 +1,12 @@ +#!/bin/sh + +if test "$1" = "finish"; then + test -z $2 && echo "feature required." && exit 1 + branch=feature/$2 + git merge --no-ff $branch && git delete-branch $branch +else + test -z $1 && echo "feature required." && exit 1 + branch=feature/$1 + git checkout -b $branch &> /dev/null + git checkout $branch &> /dev/null +fi \ No newline at end of file diff --git a/bin/git-gh-pages b/bin/git-gh-pages new file mode 100755 index 0000000..40fda3f --- /dev/null +++ b/bin/git-gh-pages @@ -0,0 +1,12 @@ +#!/bin/sh + +echo 'setting up gh-pages' +git symbolic-ref HEAD refs/heads/gh-pages \ + && rm .git/index \ + && git clean -fdx \ + && echo 'My Page' > index.html \ + && git add . \ + && git commit -a -m 'Initial commit' \ + && git push origin gh-pages \ + && git fetch origin \ + && echo 'complete' \ No newline at end of file diff --git a/bin/git-graft b/bin/git-graft index a95a823..83a5d20 100755 --- a/bin/git-graft +++ b/bin/git-graft @@ -1,7 +1,7 @@ #!/bin/sh src=$1 -dst=${2-master} +dst=$2 test -z $src && echo "source branch required." && exit 1 diff --git a/bin/git-pull-request b/bin/git-pull-request new file mode 100755 index 0000000..2a5bf3d --- /dev/null +++ b/bin/git-pull-request @@ -0,0 +1,15 @@ +#!/bin/sh + +request=$1 +repo=${PWD##*/} +user=`git config github.user` +url="https://github.com/$user/$repo/pull/$request.patch" + +test -z "$request" && echo "pull request number required" && exit 1 +test -z "$repo" && echo "failed to detect repo" && exit 2 +test -z "$user" && echo "failed to fetch github.user" && exit 3 + +echo "pulling $url" +curl -# $url \ + | git am --signoff \ + && echo "completed pull request $request" \ No newline at end of file diff --git a/bin/git-refactor b/bin/git-refactor new file mode 100755 index 0000000..68182f2 --- /dev/null +++ b/bin/git-refactor @@ -0,0 +1,12 @@ +#!/bin/sh + +if test "$1" = "finish"; then + test -z $2 && echo "refactor required." && exit 1 + branch=refactor/$2 + git merge --no-ff $branch && git delete-branch $branch +else + test -z $1 && echo "refactor required." && exit 1 + branch=refactor/$1 + git checkout -b $branch &> /dev/null + git checkout $branch &> /dev/null +fi \ No newline at end of file diff --git a/bin/git-update-extras b/bin/git-update-extras deleted file mode 100755 index 84e8ef0..0000000 --- a/bin/git-update-extras +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -orig=$PWD -version=`git extras-version` - -cd /tmp \ - && rm -fr ./git-extras \ - && git clone --depth 1 http://github.com/visionmedia/git-extras.git \ - && cd git-extras \ - && make install \ - && cd $orig \ - && echo "... updated to git-extras $version" - \ No newline at end of file diff --git a/man/git-extras.1 b/man/git-extras.1 new file mode 100644 index 0000000..242fe6b --- /dev/null +++ b/man/git-extras.1 @@ -0,0 +1,65 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "GIT\-EXTRAS" "1" "March 2011" "" "Git Extras" +. +.SH "NAME" +\fBgit\-extras\fR \- Awesome GIT utilities +. +.SH "SYNOPSIS" +\fBgit\-extras\fR [\-v,\-\-version] [\-h,\-\-help] [update] +. +.SH "COMMANDS" +. +.IP "\(bu" 4 +\fBgit\-changelog\fR changelog population +. +.IP "\(bu" 4 +\fBgit\-commits\-since\fR show commit logs since some date +. +.IP "\(bu" 4 +\fBgit\-contrib\fR show a user\'s contribution +. +.IP "\(bu" 4 +\fBgit\-count\fR show commit count +. +.IP "\(bu" 4 +\fBgit\-fresh\-branch\fR create fresh branches +. +.IP "\(bu" 4 +\fBgit\-graft\fR merge and destroy a given branch +. +.IP "\(bu" 4 +\fBgit\-ignore\fR add \.gitignore patterns +. +.IP "\(bu" 4 +\fBgit\-release\fR commit, tag and push changes to the repository +. +.IP "\(bu" 4 +\fBgit\-setup\fR set up a git repository with initial commit +. +.IP "\(bu" 4 +\fBgit\-repl\fR GIT read\-eval\-print\-loop +. +.IP "\(bu" 4 +\fBgit\-summary\fR repository summary & contrib +. +.IP "\(bu" 4 +\fBgit\-touch\fR touch and add file to the index +. +.IP "\(bu" 4 +\fBgit\-undo\fR undo one or more of the latest commits +. +.IP "\(bu" 4 +\fBgit\-pull\-request\fR pulls the given request from github +. +.IP "" 0 +. +.SH "AUTHOR" +Written by Tj Holowaychuk <\fItj@vision\-media\.ca\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-extras.html b/man/git-extras.html new file mode 100644 index 0000000..38a837c --- /dev/null +++ b/man/git-extras.html @@ -0,0 +1,120 @@ + + + + + + git-extras(1) - Awesome GIT utilities + + + + +
+ + + +
    +
  1. git-extras(1)
  2. +
  3. Git Extras
  4. +
  5. git-extras(1)
  6. +
+ +

NAME

+

+ git-extras - Awesome GIT utilities +

+ +

SYNOPSIS

+ +

git-extras [-v,--version] [-h,--help] [update]

+ +

COMMANDS

+ +
    +
  • git-changelog changelog population
  • +
  • git-commits-since show commit logs since some date
  • +
  • git-contrib show a user's contribution
  • +
  • git-count show commit count
  • +
  • git-fresh-branch create fresh branches
  • +
  • git-graft merge and destroy a given branch
  • +
  • git-ignore add .gitignore patterns
  • +
  • git-release commit, tag and push changes to the repository
  • +
  • git-setup set up a git repository with initial commit
  • +
  • git-repl GIT read-eval-print-loop
  • +
  • git-summary repository summary & contrib
  • +
  • git-touch touch and add file to the index
  • +
  • git-undo undo one or more of the latest commits
  • +
  • git-pull-request pulls the given request from github
  • +
+ + +

AUTHOR

+ +

Written by Tj Holowaychuk <tj@vision-media.ca>

+ +

REPORTING BUGS

+ +

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

+ +

SEE ALSO

+ +

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

+ + +
    +
  1. +
  2. March 2011
  3. +
  4. git-extras(1)
  5. +
+ +
+ + diff --git a/man/git-extras.md b/man/git-extras.md new file mode 100644 index 0000000..82af460 --- /dev/null +++ b/man/git-extras.md @@ -0,0 +1,35 @@ +git-extras(1) -- Awesome GIT utilities +================================= + +## SYNOPSIS + +`git-extras` [-v,--version] [-h,--help] [update] + +## COMMANDS + + - `git-changelog` changelog population + - `git-commits-since` show commit logs since some date + - `git-contrib` show a user's contribution + - `git-count` show commit count + - `git-fresh-branch` create fresh branches + - `git-graft` merge and destroy a given branch + - `git-ignore` add .gitignore patterns + - `git-release` commit, tag and push changes to the repository + - `git-setup` set up a git repository with initial commit + - `git-repl` GIT read-eval-print-loop + - `git-summary` repository summary & contrib + - `git-touch` touch and add file to the index + - `git-undo` undo one or more of the latest commits + - `git-pull-request` pulls the given request from github + +## AUTHOR + +Written by Tj Holowaychuk <> + +## REPORTING BUGS + +<> + +## SEE ALSO + +<> diff --git a/man/git-graft.1 b/man/git-graft.1 index 9b03ebb..7e12c13 100644 --- a/man/git-graft.1 +++ b/man/git-graft.1 @@ -1,10 +1,10 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "GIT\-GRAFT" "1" "October 2010" "" "Git Extras" +.TH "GIT\-GRAFT" "1" "March 2011" "" "Git Extras" . .SH "NAME" -\fBgit\-graft\fR \- Merge commits together +\fBgit\-graft\fR \- Merge and destroy a given branch . .SH "SYNOPSIS" \fBgit\-graft\fR [] diff --git a/man/git-graft.html b/man/git-graft.html index 83bb660..df34422 100644 --- a/man/git-graft.html +++ b/man/git-graft.html @@ -3,7 +3,7 @@ - git-graft(1) - Merge commits together + git-graft(1) - Merge and destroy a given branch