git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git alias question
@ 2011-12-29  1:27 Michael Horowitz
  2011-12-29  3:21 ` Miles Bader
  2011-12-29 17:08 ` Dave Borowitz
  0 siblings, 2 replies; 8+ messages in thread
From: Michael Horowitz @ 2011-12-29  1:27 UTC (permalink / raw)
  To: git

Hello all,

I have been unable to find a solution to this, so I figured I would
post to this list...

I am trying to make an easy command to let me look at the last diff to
a specified file, either plain or with a diff tool, such as vimdiff.
This is the last actual change, not just HEAD^, because the file may
not have changed in many commits.

I was able to make the following 2 aliases, which work perfectly
except for one problem...

ldiff = "!git diff `git rev-list --reverse -n 2 HEAD -- $1` -- $1"
ldifft = "!git difftool `git rev-list --reverse -n 2 HEAD -- $1` -- $1"

The problem is the limitation that shell commands are always executed
at the top-level directory of the repository.  Normally I am in a
deeply nested directory, so if I specify the file name in that
directory, it doesn't work.  Having to specify the full path relative
to the top level makes these aliases more cumbersome to use than their
worth.

Is there a way to get around this, or even a completely different way
to do this that I am missing?  I want to avoid making a completely
separate shell script.

Thanks,

Mike

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-01-02  5:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-29  1:27 git alias question Michael Horowitz
2011-12-29  3:21 ` Miles Bader
2011-12-29  5:32   ` Junio C Hamano
2011-12-29 17:08 ` Dave Borowitz
2011-12-30  1:59   ` David Aguilar
2011-12-31 21:31     ` Michael Horowitz
2011-12-31 23:30       ` Jakub Narebski
2012-01-02  5:57         ` Michael Horowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).