On Thu, Oct 30, 2008 at 12:33:53AM +0000, Petr Baudis wrote: > From: Sverre Rabbelier <srabbelier@xxxxxxxxx> > > Signed-off-by: Sverre Rabbelier <srabbelier@xxxxxxxxx> > Signed-off-by: Petr Baudis <pasky@xxxxxxx> > --- > Documentation/git-filter-branch.txt | 15 +++++++++++++++ > 1 files changed, 15 insertions(+), 0 deletions(-) > > diff --git a/Documentation/git-filter-branch.txt b/Documentation/git-filter-branch.txt > index fed6de6..2565244 100644 > --- a/Documentation/git-filter-branch.txt > +++ b/Documentation/git-filter-branch.txt > @@ -246,6 +246,21 @@ git filter-branch --commit-filter ' > fi' HEAD > ------------------------------------------------------------------------------ > > +To remove commits that are empty (do not introduce any change): > + > +------------------------------------------------------------------------------ > +git rev-list HEAD | while read c; do [ -n "$(git diff-tree --root $c)" ] || echo $c; done > revs > + > +git filter-branch --commit-filter ' > + if grep -q "$GIT_COMMIT" '"$(pwd)/"revs'; > + then > + skip_commit "$@"; > + else > + git commit-tree "$@"; > + fi' HEAD > + > +------------------------------------------------------------------------------ Why not add an option to filter-branch that removes a commit if it's empty ? It's quite useful, it helps the user concentrating on just keeping what matches *his* criteriums, and not caring about the minor details of cleansing the result. -- ·O· Pierre Habouzit ··O madcoder@xxxxxxxxxx OOO http://www.madism.org
Attachment:
pgpxkhvyYW0pN.pgp
Description: PGP signature