From f944e48cd233a6a7ffdb2a490e06318b834ffdd5 Mon Sep 17 00:00:00 2001 From: "Dmitry Yu. Naumov" <dmitri.naumov@ufz.de> Date: Tue, 11 Sep 2018 15:01:59 +0200 Subject: [PATCH] Update README.md --- .../clang-format-series-of-commits/README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dev/code-formatting/clang-format-series-of-commits/README.md b/dev/code-formatting/clang-format-series-of-commits/README.md index 9122c5d..f8cfa77 100644 --- a/dev/code-formatting/clang-format-series-of-commits/README.md +++ b/dev/code-formatting/clang-format-series-of-commits/README.md @@ -31,3 +31,10 @@ git rebase -i COMMIT_ONTO_WHICH_TO_REBASE \ && read -r -p 'Hit enter to continue' \ && git commit --all --amend --no-edit" ``` + +## filter-branch solution + +To apply `clang-format` to each commit in the range `COMMIT..HEAD` rewriting the history: +```sh +git filter-branch --tree-filter 'git-clang-format $GIT_COMMIT^' -- COMMIT..HEAD +``` -- GitLab