Out of a git console: how do I execute a batch file and then return to git console?

Solution 1:

After playing around a bit more, I found the solution myself:

cmd "/C clean.bat"

does the trick. But I got no clue, why...

Solution 2:

./clear.bat will do the trick.

Solution 3:

The Git for Windows (msysGit has been superseded by Git for Windows1) FAQ says you have 3 options:

  • Run programs that have problems using the winpty utility. This allows you to keep using the nicer mintty terminal, but can become unwieldy if you need the workaround for many programs.

  • Modify the shortcut for Git Bash to run bash directly without mintty so it uses the default console host and configure it for "Quick Edit", reasonable size and scroll-back and suitable unicode font. You'll still have to live with the other quirks of console host.

  • Install and use ConEmu.

Solution 4:

I like start clean, it opens a new window with cmd. This method has some benefits:

  • cmd.exe gets a native console
  • the new console has a native windows character encoding (e.g. cp1251 vs utf8)