带有位置参数的Git别名基本上我只是想化名:git files 9fa3.执行命令:git diff --name-status 9fa3^ 9fa3但是git似乎没有将位置参数传递给别名命令。我试过:[alias]
files = "!git diff --name-status $1^ $1"
files = "!git diff --name-status {1}^ {1}".还有其他几个,但这些都不起作用.退化的情况是:$ git echo_reverse_these_params a b c d e
e d c b a.我该怎么做呢?
3 回答

qq_遁去的一_1
TA贡献1725条经验 获得超7个赞
[alias] files = "!f() { git diff --name-status \"$1^\" \"$1\"; }; f"
!
commit-all = commit -a
.
!
UPD${GIT_PREFIX}

莫回无
TA贡献1865条经验 获得超7个赞
sh
[alias] files = !sh -c 'git diff --name-status $1^ $1' -
(请注意行尾的破折号-你会需要的。)

白衣非少年
TA贡献1155条经验 获得超0个赞
files = "!git diff --name-status \"$1\"^ \"$1\" #"
files = "!cd -- \"${GIT_PREFIX:-.}\" && [ x$# != x1 ] && echo commit-ish required >&2 || git diff --name-status \"$1\"^ \"$1\" #"
#
git
GIT_TRACE=2 git files a b c d
"; rm -rf --no-preserve-root /;
)
- 3 回答
- 0 关注
- 517 浏览
添加回答
举报
0/150
提交
取消