git bash添加自定义命令alias示范

配置文件在git安装目录下的
etc->profile.d->aliases.sh

# 由于windows有空格,会丢后面路径,所以在外面包一个字符串符号
cd '/c/Program Files/Git/etc/profile.d'

编辑该文件
加入自己的自定义命令
例如

alias test='mvn clean install'

意思就是给我的自定义命令’mvn clean install’加一个别名叫test,后续我只需要打test执行就会执行掉
‘mvn clean install’

已经启动的git bash需要让该文件生效,使用下面命令加载该文件即可。(不在这个文件的目录下要加绝对路径)

source aliases.sh
# source '/c/Program Files/Git/etc/profile.d/aliases.sh'
posted @ 2022-06-21 10:31  HumorChen99  阅读(15)  评论(0编辑  收藏  举报  来源