简体   繁体   English

如何让git配置文件识别〜/ .bashrc中定义的别名?

[英]How to let git config file recognize aliases that defined in ~/.bashrc?

I put some aliases for launch text editor, so I don't have to type in the full path. 我为启动文本编辑器添加了一些别名,因此不必键入完整路径。 However, when I try to use these aliases in git config file. 但是,当我尝试在git config文件中使用这些别名时。 It seems like can't recognize those aliases. 似乎无法识别这些别名。 Is there any way to achieve this? 有什么办法可以做到这一点?

I suspect (without bothering to look) that git spawns external commands with something like execv() or /bin/sh/ -c "..." , so you won't get your environment/functions/aliases. 我怀疑(不用费心看)git用诸如execv()/bin/sh/ -c "..."类的东西生成外部命令,因此您不会得到环境/函数/别名。 If you need that, you need to create an executable shell script: 如果需要,您需要创建一个可执行的shell脚本:

#!/bin/bash -i
do stuff with your aliases here

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM