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 + +------------------------------------------------------------------------------ + The function 'skip_commit' is defined as follows: -------------------------- -- 1.5.6.3.536.g61aad -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html