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

[PATCH 10/10] user-manual: listing commits reachable from some refs not others

From
JFJ. Bruce Fields <bfields@citi.umich.edu>
Date
May 14, 2007, 15:21 UTC
Message-ID
<35095.5721959055$1179156138@news.gmane.org>
In-Reply-To
<1179156090113-git-send-email->
From: J. Bruce Fields <bfields@citi.umich.edu>
This is just an amusing example raised by someone in irc.
Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
---
 Documentation/user-manual.txt |   44 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt
index d6ac29b..9fc2bba 100644
--- a/Documentation/user-manual.txt
+++ b/Documentation/user-manual.txt
@@ -830,6 +830,50 @@ available
 Which shows that e05db0fd is reachable from itself, from v1.5.0-rc1, and
 from v1.5.0-rc2, but not from v1.5.0-rc0.
 
+[[showing-commits-unique-to-a-branch]]
+Showing commits unique to a given branch
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Suppose you would like to see all the commits reachable from the branch
+head named "master" but not from any other head in your repository.
+
+You can list all the heads in this repository with
+gitlink:git-show-ref[1]:
+
+-------------------------------------------------
+$ git show-ref --heads
+bf62196b5e363d73353a9dcf094c59595f3153b7 refs/heads/core-tutorial
+db768d5504c1bb46f63ee9d6e1772bd047e05bf9 refs/heads/maint
+a07157ac624b2524a059a3414e99f6f44bebc1e7 refs/heads/master
+24dbc180ea14dc1aebe09f14c8ecf32010690627 refs/heads/tutorial-2
+1e87486ae06626c2f31eaa63d26fc0fd646c8af2 refs/heads/tutorial-fixes
+-------------------------------------------------
+
+We can get just the branch-head names, and remove "maint", with
+the help of the standard utilities cut and grep:
+
+-------------------------------------------------
+$ git show-ref --heads | cut -d' ' -f2 | grep -v '^refs/heads/maint'
+-------------------------------------------------
+
+And then we can ask to see all the commits reachable from maint
+but not from these other heads:
+
+-------------------------------------------------
+$ gitk maint --not $( git show-ref --heads | cut -d' ' -f2 |
+				grep -v '^refs/heads/maint' )
+-------------------------------------------------
+
+Obviously endless variations are possible; to see all commits
+reachable from some head but not from any tag in the repository:
+
+-------------------------------------------------
+$ gitk ($ git show-ref --heads ) --not  $( git show-ref --tags )
+-------------------------------------------------
+
+(See gitlink:git-rev-parse[1] for explanations of commit-selecting
+syntax such as `--not`.)
+
 [[making-a-release]]
 Creating a changelog and tarball for a software release
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- 
1.5.1.4.19.g69e2
Previous: J. Bruce FieldsNext: Luck, Tony
Message 13 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.