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

how does one interpret "git diff <commit> ^<commit>"

From
Robert P. J. Day <rpjday@crashcourse.ca>
Date
Feb 22, 2019, 13:22 UTC
Message-ID
<alpine.LFD.2.21.1902220816010.6353@localhost.localdomain>
  was perusing the git FAQ and ran across this:
  How do I obtain a list of files which have changed in a given commit?
     $ git diff --name-only <commit>^!

after playing with "git rev-parse", i figured out that the above was equivalent to (using kernel "v4.19" tag as an example):

$ git diff v4.19 ^v4.19^
diff --git a/Makefile b/Makefile
index bf3786e4ffec..69fa5c0310d8 100644
--- a/Makefile
+++ b/Makefile
@@ -2,8 +2,8 @@
 VERSION = 4
 PATCHLEVEL = 19
 SUBLEVEL = 0
-EXTRAVERSION = -rc8
-NAME = Merciless Moray
+EXTRAVERSION =
+NAME = "People's Front"

 # *DOCUMENTATION*
 # To see a list of typical targets execute "make help"
$

  but i get exactly the same output if i reverse the arguments:

$ git diff ^v4.19^ v4.19
diff --git a/Makefile b/Makefile
index bf3786e4ffec..69fa5c0310d8 100644
--- a/Makefile
+++ b/Makefile
@@ -2,8 +2,8 @@
 VERSION = 4
 PATCHLEVEL = 19
 SUBLEVEL = 0
-EXTRAVERSION = -rc8
-NAME = Merciless Moray
+EXTRAVERSION =
+NAME = "People's Front"

 # *DOCUMENTATION*
 # To see a list of typical targets execute "make help"

  so i'm confused as to how to "git diff" interprets and processes
those two arguments, as "v4.19" is, of course, a reference to a
specific commit, but "^v4.19^" appears to define all those commits not
reachable from "v4.19^". how should one read this?

rday
-- 
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                  http://crashcourse.ca/dokuwiki

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================
Next: Ævar Arnfjörð Bjarmason
Message 1 of 3 in “how does one interpret "git diff <commit> ^<commit>"”
  1. Robert P. J. DayFeb 22, 2019
  2. Ævar Arnfjörð BjarmasonFeb 22, 2019
  3. Junio C HamanoFeb 22, 2019

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.