[q] git-diff --reverse 7def2be1..7def2be1^

8 messages, 5 authors, 2016-06-15 · open the first message on its own page

[q] git-diff --reverse 7def2be1..7def2be1^

From: Ingo Molnar <hidden>
Date: 2016-06-15 22:44:47

A couple of stupid Git questions (using git-1.5.4.3-2.fc8).

Sometimes i want to see the reverse diff of a particular commit.

If i want to see the normal diff i do:

   git-log -1 -p 7def2be1

But generating the reverse diff does not work:

   git-log --reverse -1 -p 7def2be1

Because the '--reverse' here is the ordering of the revlist, not the 
direction of the patch itself. And that's OK, albeit slightly 
unintuitive.

So instead i do:

   git-diff --reverse 7def2be1..7def2be1^

I've got two observations / potential suggestions:

1) the SHA1 is duplicated above, is there a way to avoid it? Initially i 
   tried the obvious extension:

      git-diff --reverse 7def2be1..^

   But Git didnt recognize that as a valid commit range.

2) is there a way to pass something like --reversediff to git-log?

   [ time passes as i read the manpage - the final thing i do when
     every other measure fails ;-) ]

   Ah, there's "git-log -R" that would achieve this. 

   The situation still feels a tiny bit inconsistent to me, and that's 
   why my attempt to figure it out intuitively based on my existing 
   practices failed:

    a) -R is not recognized by git-diff (so i cannot just standardize 
       myself on -R and have to waste neurons on remembering the 
       distinction ;-)

    b) --reverse has different meaning in git-log and git-diff.

Perhaps one solution would be if -R was recognized by git-diff as the 
meaning of --reverse is an ABI. The extension to the sha1 range 
specifier would be nice as well, it feels intuitive to me.

Hm?

	Ingo

Re: [q] git-diff --reverse 7def2be1..7def2be1^

From: Jakub Narebski <hidden>
Date: 2016-06-15 22:44:47

Ingo Molnar [off-list ref] writes:
I've got two observations / potential suggestions:

1) the SHA1 is duplicated above, is there a way to avoid it? Initially i 
   tried the obvious extension:

      git-diff --reverse 7def2be1..^

   But Git didnt recognize that as a valid commit range.
There is shortcut for rev^..rev, namely rev^! (I'm not sure if it is
documented anywhere, though), so you could have used

        git diff 7def2be1^!
 
   [ time passes as i read the manpage - the final thing i do when
     every other measure fails ;-) ]

   Ah, there's "git-log -R" that would achieve this. 
I think you should have done this first...

-- 
Jakub Narebski
Poland
ShadeHawk on #git

Re: [q] git-diff --reverse 7def2be1..7def2be1^

From: Mikael Magnusson <hidden>
Date: 2016-06-15 22:44:47

2008/6/20 Jakub Narebski [off-list ref]:
There is shortcut for rev^..rev, namely rev^! (I'm not sure if it is
documented anywhere, though), so you could have used

       git diff 7def2be1^!
quoted
   [ time passes as i read the manpage - the final thing i do when
     every other measure fails ;-) ]
With some grepping, i found this in git-rev-parse,

       Two other shorthands for naming a set that is formed by a
commit and its parent
       commits exists. r1^@ notation means all parents of r1. r1^!
includes commit r1
       but excludes its all parents.

-- 
Mikael Magnusson

Re: [q] git-diff --reverse 7def2be1..7def2be1^

From: Mikael Magnusson <hidden>
Date: 2016-06-15 22:44:47

2008/6/20 Ingo Molnar [off-list ref]:
A couple of stupid Git questions (using git-1.5.4.3-2.fc8).

Sometimes i want to see the reverse diff of a particular commit.

If i want to see the normal diff i do:

  git-log -1 -p 7def2be1
git show 7def2b1 is a bit easier to type.

-- 
Mikael Magnusson

Re: [q] git-diff --reverse 7def2be1..7def2be1^

From: Jakub Narebski <hidden>
Date: 2016-06-15 22:44:47

Mikael Magnusson wrote:
2008/6/20 Jakub Narebski [off-list ref]:
quoted
There is shortcut for rev^..rev, namely rev^! (I'm not sure if it is
documented anywhere, though), so you could have used

       git diff 7def2be1^!
quoted
   [ time passes as i read the manpage - the final thing i do when
     every other measure fails ;-) ]
With some grepping, i found this in git-rev-parse,

       Two other shorthands for naming a set that is formed by a commit and its parent
       commits exists. r1^@ notation means all parents of r1. r1^! includes commit r1
       but excludes its all parents.
A bit strange is that neither "git rev-parse pu^!" nor "git rev-parse pu^@"
work, while the same works with git-rev-list.  WTF?

-- 
Jakub Narebski
Poland

Re: [q] git-diff --reverse 7def2be1..7def2be1^

From: Ingo Molnar <hidden>
Date: 2016-06-15 22:44:47

* Jakub Narebski [off-list ref] wrote:
quoted
   But Git didnt recognize that as a valid commit range.
There is shortcut for rev^..rev, namely rev^! (I'm not sure if it is 
documented anywhere, though), so you could have used

        git diff 7def2be1^!
nice! :-)
quoted
   [ time passes as i read the manpage - the final thing i do when
     every other measure fails ;-) ]

   Ah, there's "git-log -R" that would achieve this. 
I think you should have done this first...
to read the man page? Nobody reads the manuals, except in grave 
circumstances ;-)

(Seriously, i usually try to guess around a lot with shell commands just 
to figure out new things, and to see how intuitive they are.)

	Ingo

Re: [q] git-diff --reverse 7def2be1..7def2be1^

From: Andreas Ericsson <hidden>
Date: 2016-06-15 22:44:48

Ingo Molnar wrote:
* Jakub Narebski [off-list ref] wrote:
quoted
quoted
   But Git didnt recognize that as a valid commit range.
There is shortcut for rev^..rev, namely rev^! (I'm not sure if it is 
documented anywhere, though), so you could have used

        git diff 7def2be1^!
nice! :-)
And for just a single revision, you can do

	git show -R 7def2be1

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Re: [q] git-diff --reverse 7def2be1..7def2be1^

From: Dmitry Potapov <hidden>
Date: 2016-06-15 22:44:53

On Fri, Jun 20, 2008 at 2:05 PM, Jakub Narebski [off-list ref] wrote:
There is shortcut for rev^..rev, namely rev^! (I'm not sure if it is
documented anywhere, though),
The latter is not exactly a shortcut for the former.  You can try it at any
merge commit, and you will see different log. For instance, in Git repo:

$git rev-list 7ac749c^..7ac749c
7ac749c96d143ba4f76723959892cbaddbe8ed07
006f31d77f3dd5f813557c2839b39b2aaa22b925
53b22a9e45161004ff3260782abc4ee2a5b3e730
872354dcb3ce5f34f7ddb12d2c89d26a1ea4daf0
bc7c73e29cfb38232b5b6b1d1e8d59e7145a9860

$git rev-list 7ac749c^!
7ac749c96d143ba4f76723959892cbaddbe8ed07

So, I believe, rev^! means --first-parent rev^..rev

Dmitry
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help