git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
JFJ. Bruce Fields <bfields@citi.umich.edu>
Date
May 14, 2007, 15:21 UTC
Message-ID
<24838.6180530817$1179156134@news.gmane.org>
In-Reply-To
<11791560901-git-send-email->
From: J. Bruce Fields <bfields@citi.umich.edu>
This is partly just an excuse to mention --pretty= and rev-list.
Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
---
 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
Previous: J. Bruce FieldsNext: J. Bruce Fields
Message 11 of 17 in “user-manual: revise birdseye-view chapter”
  1. 02/10 user-manual: revise birdseye-view chapterJ. Bruce Fields, May 14, 2007
  2. Junio C HamanoMay 15, 2007
  3. J. Bruce FieldsMay 15, 2007
  4. 03/10 glossary: expand and clarify some definitions, prune cross-referencesJ. Bruce Fields, May 14, 2007
  5. Jakub NarebskiMay 14, 2007
  6. J. Bruce FieldsMay 17, 2007
  7. 04/10 user-manual: move quick-start to an appendixJ. Bruce Fields, May 14, 2007
  8. 05/10 Documentation: remove howto's now incorporated into manualJ. Bruce Fields, May 14, 2007
  9. 06/10 user-manual: move howto/make-dist.txt into user manualJ. Bruce Fields, May 14, 2007
  10. 07/10 user-manual: move howto/using-topic-branches into manualJ. Bruce Fields, May 14, 2007
  11. 08/10 user-manual: add a "counting commits" exampleJ. Bruce Fields, May 14, 2007
  12. 09/10 user-manual: introduce gitJ. Bruce Fields, May 14, 2007
  13. 10/10 user-manual: listing commits reachable from some refs not othersJ. Bruce Fields, May 14, 2007
  14. Luck, TonyMay 14, 2007
  15. user-manual: fix origin/linus confusion in topic-branches exampleJ. Bruce Fields, May 14, 2007
  16. Linus TorvaldsMay 14, 2007
  17. J. Bruce FieldsMay 14, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.