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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 22 2019, Robert P. J. Day wrote:

>   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?

I'm not sure if it answers your question, but search for "Jon Loeliger"
in "man git-rev-parse". It shows an example of a graph and what the ^REV
syntax means.

^v4.19^ looks cutsey, but just means:

    first_parent_of_v4.19_is_X = v4.19^
    not_reachable_from_X = ^$first_parent_of_v4.19_is_X



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux