Author: Nico Weber Date: 2022-04-22T15:14:04-04:00 New Revision: a45764f2f9cf0d2d6ec5bd871cc9c36ebf785ccc
URL: https://github.com/llvm/llvm-project/commit/a45764f2f9cf0d2d6ec5bd871cc9c36ebf785ccc DIFF: https://github.com/llvm/llvm-project/commit/a45764f2f9cf0d2d6ec5bd871cc9c36ebf785ccc.diff LOG: [git-clang-format] Add some examples to the help text Differential Revision: https://reviews.llvm.org/D124282 Added: Modified: clang/tools/clang-format/git-clang-format Removed: ################################################################################ diff --git a/clang/tools/clang-format/git-clang-format b/clang/tools/clang-format/git-clang-format index 1d6f216240c1c..86f4497ed599d 100755 --- a/clang/tools/clang-format/git-clang-format +++ b/clang/tools/clang-format/git-clang-format @@ -40,6 +40,16 @@ If zero or one commits are given, run clang-format on all lines that diff er between the working directory and <commit>, which defaults to HEAD. Changes are only applied to the working directory, or in the stage/index. +Examples: + To format staged changes, i.e everything that's been `git add`ed: + git clang-format + + To also format everything touched in the most recent commit: + git clang-format HEAD~1 + + If you're on a branch off main, to format everything touched on your branch: + git clang-format main + If two commits are given (requires -- diff ), run clang-format on all lines in the second <commit> that diff er from the first <commit>. _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits