diff --git a/History.md b/History.md index e1a03bf..cc5fe5c 100644 --- a/History.md +++ b/History.md @@ -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 ================== diff --git a/Readme.md b/Readme.md index a246301..72a4630 100644 --- a/Readme.md +++ b/Readme.md @@ -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 diff --git a/bin/git-effort b/bin/git-effort new file mode 100755 index 0000000..63a1622 --- /dev/null +++ b/bin/git-effort @@ -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 diff --git a/bin/git-extras b/bin/git-extras index 8424da6..e390392 100755 --- a/bin/git-extras +++ b/bin/git-extras @@ -1,6 +1,6 @@ #!/bin/sh -VERSION="0.9.0" +VERSION="1.1.0" update() { local orig=$PWD diff --git a/bin/git-squash b/bin/git-squash new file mode 100755 index 0000000..98ab229 --- /dev/null +++ b/bin/git-squash @@ -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 diff --git a/bin/git-summary b/bin/git-summary index 7e9dc0e..19d1ffa 100755 --- a/bin/git-summary +++ b/bin/git-summary @@ -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" diff --git a/etc/bash_completion.sh b/etc/bash_completion.sh index 273c680..adff45f 100644 --- a/etc/bash_completion.sh +++ b/etc/bash_completion.sh @@ -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" } diff --git a/man/git-fresh-branch.1 b/man/git-fresh-branch.1 index 73742a7..c2f2851 100644 --- a/man/git-fresh-branch.1 +++ b/man/git-fresh-branch.1 @@ -16,7 +16,7 @@ Creates empty local branch named \. . .P -The name of the branch to delete\. +The name of the branch to create\. . .SH "EXAMPLES" . diff --git a/man/git-fresh-branch.html b/man/git-fresh-branch.html index 87e8fed..5e48b4d 100644 --- a/man/git-fresh-branch.html +++ b/man/git-fresh-branch.html @@ -86,7 +86,7 @@

<branchname>

-

The name of the branch to delete.

+

The name of the branch to create.

EXAMPLES

diff --git a/man/git-fresh-branch.md b/man/git-fresh-branch.md index 2c4ab52..a936c02 100644 --- a/man/git-fresh-branch.md +++ b/man/git-fresh-branch.md @@ -13,7 +13,7 @@ git-fresh-branch(1) -- Create fresh branches <branchname> - The name of the branch to delete. + The name of the branch to create. ## EXAMPLES