Added git-squash

This commit is contained in:
Tj Holowaychuk 2012-02-01 13:07:14 -08:00
parent 391431d267
commit 902996edd2
2 changed files with 15 additions and 0 deletions

View file

@ -25,6 +25,7 @@ $ brew install git-extras
## Commands
- `git extras`
- `git squash`
- `git summary`
- `git changelog`
- `git commits-since`
@ -202,6 +203,10 @@ $ git commits-since yesterday
TJ Holowaychuk - Fixed readme
```
## git-squash [msg]
Squashes the current branch into a single commit with the given `[msg]`.
## git-count
Output commit count:

10
bin/git-squash Executable file
View file

@ -0,0 +1,10 @@
#!/bin/sh
# TODO: warn on master
branch=`git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
msg=${1-Squashed $branch}
git checkout -b squash-tmp master \
&& git merge --squash $branch \
&& git commit -m $msg \
&& git branch -M $branch