带有位置参数的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 回答
慕森王
TA贡献1777条经验 获得超3个赞
[alias] files = "!f() { git diff --name-status \"$1^\" \"$1\"; }; f"
!
commit-all = commit -a
.
!
UPD${GIT_PREFIX}
元芳怎么了
TA贡献1798条经验 获得超7个赞
sh
[alias] files = !sh -c 'git diff --name-status $1^ $1' -
(请注意行尾的破折号-你会需要的。)
温温酱
TA贡献1752条经验 获得超4个赞
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 关注
- 428 浏览
添加回答
举报
0/150
提交
取消