changed git-squash(1)

This commit is contained in:
TJ Holowaychuk 2012-02-04 13:51:43 -08:00
parent 183920262a
commit 1c62e436b7
2 changed files with 19 additions and 12 deletions

View file

@ -202,10 +202,6 @@ $ 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:
@ -353,7 +349,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`.)
@ -362,6 +358,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

View file

@ -1,10 +1,12 @@
#!/bin/sh
# TODO: warn on master
src=$1
msg=$2
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
test -z $src && echo "source branch required." && exit 1
git merge --squash $src && git branch -d $src
if test -n $msg
git commit -a -m "$msg"
fi