git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Horowitz <michael.horowitz@ieee.org>
To: git <git@vger.kernel.org>
Subject: git alias question
Date: Wed, 28 Dec 2011 20:27:59 -0500	[thread overview]
Message-ID: <CAFLRbopjqW7OEWN4kxy+6Gb828h4zBC_h=4WiP-q1__LeezxUw@mail.gmail.com> (raw)

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

             reply	other threads:[~2011-12-29  1:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-29  1:27 Michael Horowitz [this message]
2011-12-29  3:21 ` git alias question 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFLRbopjqW7OEWN4kxy+6Gb828h4zBC_h=4WiP-q1__LeezxUw@mail.gmail.com' \
    --to=michael.horowitz@ieee.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).