multiple git commands one line on vs code terminal

Viewed 109

git add . && git commit -m "mymsg" && git push

it's doensn't work on my vscode..

error:

git add . && commit -m "msg" && push -u ori ... ~~ The token '&&' is not a valid statement separator in this version.

2 Answers

You can use semicolon as a separator:

git status ; git status

Not sure if this is the best option, but you can workaround by choosing the Git Bash shell selector, i.e., specify the exact executable that you want to use in the settings file, for instance:

// Git Bash
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"

// Bash on Ubuntu (on Windows)
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\bash.exe"

// Cygwin
"terminal.integrated.shell.windows": "C:\\cygwin64\\bin\\bash.exe"

// Cmder
"terminal.integrated.shell.windows": "C:\\Program Files\\cmder\\Cmder.exe"

Take a look at the detailed documentation about Integrated Terminal

Related