别名错误:在Gitbash中使用cd命令



我正在尝试向git添加一个别名,以重定向到项目文件夹,打开VS代码并运行本地服务器

我的别名:

[alias]
creative = cd e:/work/vero/creative-app/front-end && code . && npm rune serve

问题是当运行git creative时,响应是:

expansion of alias 'creative' failed; 'cd' is not a git command

只需在别名前加一个!,它将由bash而不是git直接解释。

来自文档:

As you can tell, Git simply replaces the new command with whatever you
alias it for. However, maybe you want to run an external command,
rather than a Git subcommand. In that case, you start the command with
a ! character.

最新更新