是否可以扩展(覆盖)git命令? [英] Is it possible to extend (Override) git command?

查看:79
本文介绍了是否可以扩展(覆盖)git命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能在调用其别名之前覆盖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中提到了storecreate)

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆