Alias error: using cd command with Git bash

Alias error: using cd command with Git bash

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

我的别名:

[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 解释。

来自doc :

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.