Merge branch 'master' of github:visionmedia/git-extras

This commit is contained in:
David Baumgold 2012-02-08 10:54:06 -05:00
commit 6ae2ba17ff
10 changed files with 75 additions and 11 deletions

View file

@ -1,4 +1,14 @@
1.1.0 / 2012-02-07
==================
* Added `git-effort(1)` (not yet complete)
1.0.0 / 2012-02-04
==================
* Added `git-squash BRANCH [MSG]` to merge as a single commit
0.9.0 / 2012-01-15
==================

View file

@ -31,7 +31,9 @@ $ brew install git-extras
## Commands
- `git extras`
- `git squash`
- `git summary`
- `git effort`
- `git changelog`
- `git commits-since`
- `git pull-request`
@ -169,6 +171,12 @@ the commmitish range:
$ git summary v42..
```
## git-effort
Displays "effort" statistics, currently just the number of commits per file, showing highlighting where the most activity is.
![git effort](http://f.cl.ly/items/2B0D1x3v3w023s1r2t0g/Grab.png)
## git-repl
GIT read-eval-print-loop:
@ -354,7 +362,7 @@ Create empty local branch `name`:
$ git fresh-branch docs
```
## git-graft <src-branch> <dest-branch>
## git-graft <src-branch> [dest-branch]
Merge commits from `src-branch` into `dest-branch`. (`dest-branch` defaults to `master`.)
@ -363,6 +371,15 @@ $ git graft new_feature dev
$ git graft new_feature
```
## git-squash <src-branch> [msg]
Merge commits from `src-branch` into the current branch as a _single_ commit. When `[msg]` is given `git-commit(1)` will be invoked with that message. This is useful when small individual commits within a topic branch are irrelevant and you want to consider the topic as a single change.
```bash
$ git squash fixed-cursor-styling
$ git squash fixed-cursor-styling "Fixed cursor styling"
```
## git-changelog
Populate a file whose name matches `change|history -i_` with commits

20
bin/git-effort Executable file
View file

@ -0,0 +1,20 @@
#!/bin/sh
files=`git ls-files`
echo
echo " file commits"
echo
for file in $files; do
commits=`git log --oneline $file | wc -l`
color='90'
test $commits -gt 10 && color='33'
test $commits -gt 25 && color='93'
test $commits -gt 50 && color='32'
test $commits -gt 100 && color='92'
printf " \033[${color}m%-45s %d\033[0m\n" $file $commits
done
echo

View file

@ -1,6 +1,6 @@
#!/bin/sh
VERSION="0.9.0"
VERSION="1.1.0"
update() {
local orig=$PWD

12
bin/git-squash Executable file
View file

@ -0,0 +1,12 @@
#!/bin/sh
src=$1
msg=$2
test -z $src && echo "source branch required." && exit 1
git merge --squash $src
if test -n "$msg"; then
git commit -a -m "$msg" && git branch -D $src
fi

View file

@ -1,11 +1,12 @@
#!/bin/sh
COMMITISH=""
test $# -ne 0 && COMMITISH=$@
commit=""
test $# -ne 0 && commit=$@
project=${PWD##*/}
commit_count=`git log --oneline $COMMITISH | wc -l | tr -d ' '`
commit_count=`git log --oneline $commit | wc -l | tr -d ' '`
file_count=`git ls-files | wc -l | tr -d ' '`
authors=`git shortlog -n -s $COMMITISH | awk '
authors=`git shortlog -n -s $commit | awk '
{ args[NR] = $0; sum += $0 }
END {
for (i = 1; i <= NR; ++i) {
@ -16,8 +17,8 @@ authors=`git shortlog -n -s $COMMITISH | awk '
echo
echo " project: $project"
echo " commits: $commit_count"
if test "$COMMITISH" = ""; then
echo " files : $file_count"
if test "$commit" = ""; then
echo " files : $file_count"
fi
echo " authors: "
echo "$authors"

View file

@ -32,6 +32,10 @@ _git_graft(){
__gitcomp "$(__git_heads)"
}
_git_squash(){
__gitcomp "$(__git_heads)"
}
__git_extras_workflow(){
__gitcomp "$(__git_heads | grep ^$1/ | sed s/^$1\\///g) finish"
}

View file

@ -16,7 +16,7 @@ Creates empty local branch named <branchname>\.
<branchname>
.
.P
The name of the branch to delete\.
The name of the branch to create\.
.
.SH "EXAMPLES"
.

View file

@ -86,7 +86,7 @@
<p> &lt;branchname&gt;</p>
<p> The name of the branch to delete.</p>
<p> The name of the branch to create.</p>
<h2 id="EXAMPLES">EXAMPLES</h2>

View file

@ -13,7 +13,7 @@ git-fresh-branch(1) -- Create fresh branches
&lt;branchname&gt;
The name of the branch to delete.
The name of the branch to create.
## EXAMPLES