假设我们已经编辑了foo.c文件。
编写git add foo*是可能的,但是如果我想编写git add *o*来减少击键次数呢?有没有办法在git CLI界面中实现这种行为?
发布于 2014-04-28 16:19:04
如果您使用的是Bash兼容的外壳(如Bash),就已经可以使用。实际上,将foo*或*o*扩展到foo.c的是shell本身,而不是git客户机。
但是要知道,如果你碰巧有另一个文件匹配全局模式(例如not-to-be-added.c),它也会被添加进来。
发布于 2014-04-28 16:19:34
你所要求的实际上是有效的。
$ touch foo.c
$ touch bar.c
$ git status
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# bar.c
# foo.c
$ git add *o*
$ git status
# Changes to be committed:
# (use "git rm --cached <file>..." to unstage)
#
# new file: foo.c
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# bar.chttps://stackoverflow.com/questions/23335852
复制相似问题