From: J. Bruce Fields Date: Sun, 13 May 2007 06:14:45 +0000 (-0400) Subject: user-manual: add a "counting commits" example X-Git-Tag: v1.5.1.5~1^2~3 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=46acd3fa32404a9373d48c9caba271c34357ec9f;p=git.git 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" --- diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt index 9cc5fc9db..242f5aa47 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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~