Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@citi.umich.edu>2007-05-13 10:14:45 +0400
committerJ. Bruce Fields <bfields@citi.umich.edu>2007-05-18 05:58:51 +0400
commit46acd3fa32404a9373d48c9caba271c34357ec9f (patch)
treed237e5bebcc98e938c6c6a0c96f394081b54ce5e
parent9e2163ea45b688e9de4744ebb9b01ea7e1ed8d56 (diff)
user-manual: add a "counting commits" example
This is partly just an excuse to mention --pretty= and rev-list. Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
-rw-r--r--Documentation/user-manual.txt19
1 files changed, 19 insertions, 0 deletions
diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt
index 9cc5fc9db3..242f5aa479 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..mybranch | 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..mybranch | wc -l
+-------------------------------------------------
+
[[checking-for-equal-branches]]
Check whether two branches point at the same history
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~