[PATCH] D124282: [git-clang-format] Add some examples to the help text

Nico Weber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 22 10:53:18 PDT 2022


thakis created this revision.
thakis added reviewers: MyDeveloperDay, curdeius.
Herald added a project: All.
thakis requested review of this revision.

https://reviews.llvm.org/D124282

Files:
  clang/tools/clang-format/git-clang-format


Index: clang/tools/clang-format/git-clang-format
===================================================================
--- clang/tools/clang-format/git-clang-format
+++ clang/tools/clang-format/git-clang-format
@@ -40,6 +40,16 @@
 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>.
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124282.424538.patch
Type: text/x-patch
Size: 821 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220422/d3ca9e0b/attachment-0001.bin>


More information about the cfe-commits mailing list