是否可以扩展(覆盖)git命令? [英] Is it possible to extend (Override) git command?
问题描述
是否有可能在调用其别名之前覆盖git命令或运行其他git命令.像这样:git checkout .
-> git stash && git stash apply && git checkout .
.意外结帐后,我会考虑
我添加了一个用于结帐的快捷方式:alias.co = checkout
,现在已经习惯于键入它,当我使用没有快捷方式的机器时,我会感到惊讶. /p>
您可以在这样的快捷方式上插入命令.
git stash
上的一个词:创建这种隐藏的另一种方式:
git stash store $(git stash create)
其优点是不修改磁盘上的文件(并可能触发监视文件修改的操作...)
(git help stash
中提到了store
和create
)
Is it possible to override git command or run another git commands before calling its alias. Like so: git checkout .
-> git stash && git stash apply && git checkout .
. After accidental checkout i think about it
I added a shortcut for checkout : alias.co = checkout
, and am now so used to type it that I get surprised when I use a machine without the shortcut.
You could plug your command on such a shortcut.
A word on git stash
: another way to create such a stash :
git stash store $(git stash create)
This has the advantage of not modifying the files on disk (and possibly triggering some actions watching for files modification ...)
(store
and create
are mentionned in git help stash
)
这篇关于是否可以扩展(覆盖)git命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!