Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/visionmedia/git-extras
Browse files Browse the repository at this point in the history
  • Loading branch information
jweslley committed May 19, 2011
2 parents ae511e0 + a0de28f commit 8c4cabd
Show file tree
Hide file tree
Showing 30 changed files with 510 additions and 98 deletions.
31 changes: 31 additions & 0 deletions History.md
Expand Up @@ -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
==================

Expand Down
22 changes: 22 additions & 0 deletions LICENSE
@@ -0,0 +1,22 @@
(The MIT License)

Copyright (c) 2010-2011 TJ Holowaychuk <tj@vision-media.ca>

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.
1 change: 1 addition & 0 deletions Makefile
Expand Up @@ -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), \
Expand Down
49 changes: 44 additions & 5 deletions Readme.md
Expand Up @@ -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
Expand All @@ -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] &lt;name&gt;

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 &lt;number&gt;

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/<github.user>/<dirname>`

git pull-request 604

## git-contrib

Expand Down Expand Up @@ -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.
Expand Down
12 changes: 12 additions & 0 deletions bin/git-bug
@@ -0,0 +1,12 @@
#!/bin/sh

if test "$1" = "finish"; then
test -z $2 && echo "bug <name> required." && exit 1
branch=bug/$2
git merge --no-ff $branch && git delete-branch $branch
else
test -z $1 && echo "bug <name> required." && exit 1
branch=bug/$1
git checkout -b $branch &> /dev/null
git checkout $branch &> /dev/null
fi
5 changes: 3 additions & 2 deletions bin/git-changelog
Expand Up @@ -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
Expand All @@ -20,4 +21,4 @@ else
if [ -f $CHANGELOG ]; then cat $CHANGELOG >> $tmp; fi
mv $tmp $CHANGELOG
test -n "$EDITOR" && $EDITOR $CHANGELOG
fi
fi
20 changes: 20 additions & 0 deletions 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
2 changes: 0 additions & 2 deletions bin/git-extras-version

This file was deleted.

12 changes: 12 additions & 0 deletions bin/git-feature
@@ -0,0 +1,12 @@
#!/bin/sh

if test "$1" = "finish"; then
test -z $2 && echo "feature <name> required." && exit 1
branch=feature/$2
git merge --no-ff $branch && git delete-branch $branch
else
test -z $1 && echo "feature <name> required." && exit 1
branch=feature/$1
git checkout -b $branch &> /dev/null
git checkout $branch &> /dev/null
fi
12 changes: 12 additions & 0 deletions 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'
2 changes: 1 addition & 1 deletion 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

Expand Down
15 changes: 15 additions & 0 deletions 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"
12 changes: 12 additions & 0 deletions bin/git-refactor
@@ -0,0 +1,12 @@
#!/bin/sh

if test "$1" = "finish"; then
test -z $2 && echo "refactor <name> required." && exit 1
branch=refactor/$2
git merge --no-ff $branch && git delete-branch $branch
else
test -z $1 && echo "refactor <name> required." && exit 1
branch=refactor/$1
git checkout -b $branch &> /dev/null
git checkout $branch &> /dev/null
fi
13 changes: 0 additions & 13 deletions bin/git-update-extras

This file was deleted.

65 changes: 65 additions & 0 deletions 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>

0 comments on commit 8c4cabd

Please sign in to comment.