Added syntax highlighting; numerous tweaks to punctuation; use present tense consistently throughout; tweaked markup so commands are backticked for readability.

This commit is contained in:
Tony 2011-09-28 09:25:15 -03:00
parent 897ed16e6b
commit f51e56b4e2

516
Readme.md
View file

@ -1,348 +1,434 @@
# Git Extras
Little git extras.
Little git extras.
## Installation
Clone / Tarball:
```bash
$ make install
```
One-liner:
$ curl https://raw.github.com/visionmedia/git-extras/master/bin/git-extras | INSTALL=y sh
```bash
$ curl https://raw.github.com/visionmedia/git-extras/master/bin/git-extras | INSTALL=y sh
```
Brew (buggy):
[Brew](github.com/mxcl/homebrew/) (buggy):
$ brew install git-extras
```bash
$ brew install git-extras
```
## Commands
- git extras
- git summary
- git changelog
- git commits-since
- git pull-request
- git count
- git create-branch
- git apply-branch
- git delete-branch
- git delete-submodule
- git delete-tag
- git fresh-branch
- git graft
- git alias
- git ignore
- git release
- git contrib
- git repl
- git undo
- git gh-pages
- git setup
- git touch
- git feature
- git refactor
- git bug
- `git extras`
- `git summary`
- `git changelog`
- `git commits-since`
- `git pull-request`
- `git count`
- `git create-branch`
- `git apply-branch`
- `git delete-branch`
- `git delete-submodule`
- `git delete-tag`
- `git fresh-branch`
- `git graft`
- `git alias`
- `git ignore`
- `git release`
- `git contrib`
- `git repl`
- `git undo`
- `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.
The main `git-extras` command.
For example if you wish to update to the latest version of git-extras simply execute:
Output the current `--version`:
```bash
$ git extras
```
List available commands:
```bash
$ git extras --help
```
Update to the latest `git-extras`:
```bash
$ git extras update
```
$ git extras update
## gh-pages
Sets up the `gh-pages` branch.
Sets up the `gh-pages` branch. (See [GitHub Pages](http://pages.github.com/) documentation.)
## 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
Create the given feature, refactor, or bug branch `name`:
Finally when finished, we can add `finish`, merging it into the current branch:
$ git checkout master
$ git feature finish dependencies
```bash
$ git feature dependencies
```
Afterwards, the same command will check it out:
```bash
$ git checkout master
$ git feature dependencies
```
When finished, we can `feature finish` to merge it into the current branch:
```bash
$ git checkout master
$ git feature finish dependencies
```
All of this works with `feature`, `bug`, or `refactor`.
`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/<github.user>/<dirname>`
Pull a GitHub pull-request `number`, and apply it
via `git am`.
git pull-request 604
The git config `github.user` must be present, and the dirname must
map to `https://github.com/<github.user>/<dirname>`.
## git-contrib
```bash
git pull-request 604
```
Output a user's contributions to a project, based on the author name:
## git-contrib &lt;author&gt;
$ git contrib visionmedia
visionmedia (18):
Export STATUS_CODES
Replaced several Array.prototype.slice.call() calls with Array.prototype.unshift.call()
Moved help msg to node-repl
Added multiple arg support for sys.puts(), print(), etc.
Fix stack output on socket error
...
Output `author`'s contributions to a project:
```bash
$ git contrib visionmedia
visionmedia (18):
Export STATUS_CODES
Replaced several Array.prototype.slice.call() calls with Array.prototype.unshift.call()
Moved help msg to node-repl
Added multiple arg support for sys.puts(), print(), etc.
Fix stack output on socket error
...
```
## git-summary
Outputs a repo summary:
$ git summary
```bash
$ git summary
project: git-extras
commits: 163
files : 93
authors:
97 Tj Holowaychuk 59.5%
37 Jonhnny Weslley 22.7%
8 Kenneth Reitz 4.9%
5 Aggelos Orfanakos 3.1%
3 Jonathan "Duke" Leto 1.8%
2 Gert Van Gool 1.2%
2 Domenico Rotiroti 1.2%
2 Devin Withers 1.2%
2 TJ Holowaychuk 1.2%
1 Nick Campbell 0.6%
1 Alex McHale 0.6%
1 Jason Young 0.6%
1 Jens K. Mueller 0.6%
1 Guillermo Rauch 0.6%
project: git-extras
commits: 163
files : 93
authors:
97 Tj Holowaychuk 59.5%
37 Jonhnny Weslley 22.7%
8 Kenneth Reitz 4.9%
5 Aggelos Orfanakos 3.1%
3 Jonathan "Duke" Leto 1.8%
2 Gert Van Gool 1.2%
2 Domenico Rotiroti 1.2%
2 Devin Withers 1.2%
2 TJ Holowaychuk 1.2%
1 Nick Campbell 0.6%
1 Alex McHale 0.6%
1 Jason Young 0.6%
1 Jens K. Mueller 0.6%
1 Guillermo Rauch 0.6%
```
This command can also take a commitish, and will print a summary for the range
of commits included in the commitish:
This command can also take a *commitish*, and will print a summary for commits in
the commmitish range:
$ git summary v42..
```bash
$ git summary v42..
```
## git-apply-branch &lt;name&gt;
Applies the diff of the given branch `name`:
$ git apply-branch mybranch
Effectively a shortcut for:
$ git diff ..mybranch | git apply
Apply the diff of the given branch `name`:
```bash
$ git apply-branch mybranch
```
This is effectively a shortcut for:
```bash
$ git diff ..mybranch | git apply
```
## git-repl
GIT read-eval-print-loop:
GIT read-eval-print-loop:
$ git repl
```bash
$ git repl
git> ls-files
History.md
Makefile
Readme.md
bin/git-changelog
bin/git-count
bin/git-delete-branch
bin/git-delete-tag
bin/git-ignore
bin/git-release
git> ls-files
History.md
Makefile
Readme.md
bin/git-changelog
bin/git-count
bin/git-delete-branch
bin/git-delete-tag
bin/git-ignore
bin/git-release
git> quit
git> quit
```
## git-commits-since [date]
List of commits since the given _date_, defaulting to "last week":
List commits since `date` (defaults to "last week"):
$ git commits-since
... changes since last week
TJ Holowaychuk - Fixed readme
TJ Holowaychuk - Added git-repl
TJ Holowaychuk - Added git-delete-tag
TJ Holowaychuk - Added git-delete-branch
```bash
$ git commits-since
... changes since last week
TJ Holowaychuk - Fixed readme
TJ Holowaychuk - Added git-repl
TJ Holowaychuk - Added git-delete-tag
TJ Holowaychuk - Added git-delete-branch
$ git commits-since yesterday
... changes since yesterday
TJ Holowaychuk - Fixed readme
$ git commits-since yesterday
... changes since yesterday
TJ Holowaychuk - Fixed readme
```
## git-count
Output commit total:
Output commit count:
$ git count
```bash
$ git count
total 1844
total 1844
```
Output verbose commit count details:
Output detailed commit count:
$ git count --all
```bash
$ git count --all
visionmedia (1285)
Tj Holowaychuk (430)
Aaron Heckmann (48)
csausdev (34)
ciaranj (26)
Guillermo Rauch (6)
Brian McKinney (2)
Nick Poulden (2)
Benny Wong (2)
Justin Lilly (1)
isaacs (1)
Adam Sanderson (1)
Viktor Kelemen (1)
Gregory Ritter (1)
Greg Ritter (1)
ewoudj (1)
James Herdman (1)
Matt Colyer (1)
visionmedia (1285)
Tj Holowaychuk (430)
Aaron Heckmann (48)
csausdev (34)
ciaranj (26)
Guillermo Rauch (6)
Brian McKinney (2)
Nick Poulden (2)
Benny Wong (2)
Justin Lilly (1)
isaacs (1)
Adam Sanderson (1)
Viktor Kelemen (1)
Gregory Ritter (1)
Greg Ritter (1)
ewoudj (1)
James Herdman (1)
Matt Colyer (1)
total 1844
total 1844
```
## git-release
Release commit with the given &lt;tag&gt;.
Release commit with the given &lt;tag&gt;:
$ git release 0.1.0
```bash
$ git release 0.1.0
```
Does the following:
- Commits changes (to changelog etc) with message "Release &lt;tag&gt;"
- Tags with the given &lt;tag&gt;
- Pushes the branch / tags
Does the following:
- Commits changes (to changelog etc) with message "Release &lt;tag&gt;"
- Tags with the given &lt;tag&gt;
- Push the branch / tags
## git-alias
Define, search and show aliases.
Define, search and show aliases.
Defining a new alias:
Define a new alias:
$ git alias last "cat-file commit HEAD"
```bash
$ git alias last "cat-file commit HEAD"
```
Providing only one argument, `git-alias` searchs for aliases matching the given value:
Search for aliases that match a pattern (one argument):
$ git alias ^la
last = cat-file commit HEAD
```bash
$ git alias ^la
last = cat-file commit HEAD
```
`git-alias` will show all aliases if no argument is given:
Show all aliases (no arguments):
$ 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>
```bash
$ 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 [pattern ...]
To lazy to open up _.gitignore_? me too! simply pass some patterns:
Too lazy to open up `.gitignore`? Me too!
$ git ignore build "*.o" "*.log"
... added 'build'
... added '*.o'
... added '*.log'
```bash
$ git ignore build "*.o" "*.log"
... added 'build'
... added '*.o'
... added '*.log'
```
Running `git-ignore` without a pattern will display the current patterns:
$ git ignore
build
*.o
*.log
Without any patterns, `git-ignore` displays currently ignored patterns:
```bash
$ git ignore
build
*.o
*.log
```
## git-create-branch &lt;name&gt;
Creates local and remote branch _name_.
Create local and remote branch `name`:
$ git create-branch development
```bash
$ git create-branch development
```
Adding patterns from an existing template:
$ git ignore -t rails
Add patterns from an existing template:
```bash
$ git ignore -t rails
```
## git-delete-branch &lt;name&gt;
Deletes local and remote branch _name_.
Delete local and remote branch `name`:
$ git delete-branch integration
```bash
$ git delete-branch integration
```
## git-delete-submodule &lt;name&gt;
Deletes submodule _name_.
Delete submodule `name`:
$ git delete-submodule lib/foo
```bash
$ git delete-submodule lib/foo
```
## git-delete-tag &lt;name&gt;
Deletes local and remote tag _name_.
Delete local and remote tag `name`:
$ git delete-tag 0.0.1
```bash
$ git delete-tag 0.0.1
```
## git-fresh-branch &lt;name&gt;
Creates empty local branch _name_.
Create empty local branch `name`:
$ git fresh-branch docs
```bash
$ git fresh-branch docs
```
## git-graft &lt;src-branch&gt; &lt;dest-branch&gt;
Merge commits from _src-branch_ into _dest-branch_ which defaults to _master_.
Merge commits from `src-branch` into `dest-branch`. (`dest-branch` defaults to `master`.)
$ git graft new_feature dev
$ git graft new_feature
```bash
$ git graft new_feature dev
$ git graft new_feature
```
## git-changelog
Populates the file named matching _change|history -i_ with the commits
since the previous tag or since the project began when no tags are present. Opens the changelog in **$EDITOR** when set.
Populate a file whose name matches `change|history -i_` with commits
since the previous tag. (If there are no tags, populates commits since the project began.)
$ git changelog && cat History.md
Opens the changelog in `$EDITOR` when set.
n.n.n / 2010-08-05
==================
```bash
$ git changelog && cat History.md
* Docs for git-ignore. Closes #3
* Merge branch 'ignore'
* Added git-ignore
* Fixed <tag> in docs
* Install docs
* Merge branch 'release'
* Added git-release
* Passing args to git shortlog
* Added --all support to git-count
* Initial commit
n.n.n / 2010-08-05
==================
Listing commits:
* Docs for git-ignore. Closes #3
* Merge branch 'ignore'
* Added git-ignore
* Fixed <tag> in docs
* Install docs
* Merge branch 'release'
* Added git-release
* Passing args to git shortlog
* Added --all support to git-count
* Initial commit
```
$ git changelog --list
List commits:
* Docs for git-ignore. Closes #3
* Merge branch 'ignore'
* Added git-ignore
* Fixed <tag> in docs
* Install docs
* Merge branch 'release'
* Added git-release
* Passing args to git shortlog
* Added --all support to git-count
* Initial commit
```bash
$ git changelog --list
* Docs for git-ignore. Closes #3
* Merge branch 'ignore'
* Added git-ignore
* Fixed <tag> in docs
* Install docs
* Merge branch 'release'
* Added git-release
* Passing args to git shortlog
* Added --all support to git-count
* Initial commit
```
## git-undo
Removes the latest commit
Remove the latest commit:
git undo
```bash
git undo
```
Remove the latest 3 commits:
git undo 3
```bash
git undo 3
```
## 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.
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.
## git-touch [filename]
Call `touch` on the given file and add it to the current index. Used one-step creating new files.
Call `touch` on the given file, and add it to the current index. One-step creation of new files.