git alias question

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

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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]