Home > database >  Alias error: using cd command with Git bash
Alias error: using cd command with Git bash

Time:12-24

I am trying to add an alias to git to redirect to the project folder, open VS Code and run a local server

my alias:

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

problem is when run git creative response is :

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

CodePudding user response:

Just prepend a ! to your alias, and it will be interpreted by bash rather than git directly.

From the 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.
  • Related