[git-clang-format] Add some examples to the help text
authorNico Weber <thakis@chromium.org>
Fri, 22 Apr 2022 17:51:05 +0000 (13:51 -0400)
committerNico Weber <thakis@chromium.org>
Fri, 22 Apr 2022 19:14:04 +0000 (15:14 -0400)
Differential Revision: https://reviews.llvm.org/D124282

clang/tools/clang-format/git-clang-format

index 1d6f216240c1cd504bf11a4c780e588288ad731b..86f4497ed599dfc5dd20aea91ec45fe091d51b10 100755 (executable)
@@ -40,6 +40,16 @@ If zero or one commits are given, run clang-format on all lines that differ
 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 differ from the first <commit>.