Thread (1 message) 1 message, 1 author, 2016-06-15
DORMANTno replies

[PATCH 08/10] user-manual: add a "counting commits" example

From: J. Bruce Fields <hidden>
Date: 2016-06-15 22:43:10
Subsystem: documentation, the rest · Maintainers: Jonathan Corbet, Linus Torvalds

Possibly related (same subject, not in this thread)

From: J. Bruce Fields <redacted>

This is partly just an excuse to mention --pretty= and rev-list.

Signed-off-by: "J. Bruce Fields" <redacted>
---
 Documentation/user-manual.txt |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt
index 3f51522..e86e46c 100644
--- a/Documentation/user-manual.txt
+++ b/Documentation/user-manual.txt
@@ -690,6 +690,25 @@ may be any path to a file tracked by git.
 Examples
 --------
 
+[[counting-commits-on-a-branch]]
+Counting the number of commits on a branch
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Suppose you want to know how many commits you've made on "mybranch"
+since it diverged from "origin":
+
+-------------------------------------------------
+$ git log --pretty=oneline origin..maint | wc -l
+-------------------------------------------------
+
+Alternatively you may often see this sort of thing done with the
+lower-level command gitlink:git-rev-list[1], which just lists the SHA1's
+of all the given commits:
+
+-------------------------------------------------
+$ git rev-list origin..maint | wc -l
+-------------------------------------------------
+
 [[checking-for-equal-branches]]
 Check whether two branches point at the same history
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- 
1.5.1.4.19.g69e2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help