Kein Kein - 1 month ago 9
Git Question

How can I run 'git diff some/long/file/name' without typing the full path?

In my workflow, I often run the following pair of commands:

$ git status
M README.txt
M some/long/file/name
$ git diff some/long/file/name


Is there any way, for fast typing/use_shortcat for long file name without copying it name (this action require using mouse and it's no so fast like typing)?
Maybe something like
git diff $2
, where
$2
is second changed file from the status list...?

Answer

This tool (SCM Breeze) can do what you need, specifically see this part of the docs

enter image description here For example, if ga was your alias for git add, instead of typing something like:

$ ga assets/git_breeze/config* assets/git_breeze/install.sh You can

type this instead:

$ ga $e2 $e3 $e11 

But SCM Breeze aliases ga to the git_add_shortcuts function, which is smart enough to expand integers and ranges, so all you need to type is:

$ ga 2 3 11

I think it suits your needs better than the solutions that are in the post I linked to in my comment above