Git alias with positional parameters

前端 未结 7 1026
北荒
北荒 2020-11-22 12:35

Basically I\'m trying to alias:

git files 9fa3

...to execute the command:

git diff --name-status 9fa3^ 9fa3
7条回答
  •  旧巷少年郎
    2020-11-22 13:23

    You can also reference sh directly (instead of creating a function):

    [alias]
            files = !sh -c 'git diff --name-status $1^ $1' -
    

    (Note the dash at the end of the line -- you'll need that.)

提交回复
热议问题