Lahiru Chandima Lahiru Chandima -3 years ago 253
Git Question

Git bash (mintty). How to open maximized

I updated git for windows and found that it now has

mintty
as the command prompt for git bash. It is much better than previous windows command prompt based git bash.

It would be great if I could open the git bash initially maximized. There is a command line argument for mintty to open maximized.

-w, --window normal|min|max|full


But, I don't know how I can pass this argument to mintty when I open git bash from 'Open git bash here' context menu.

Does anyone know how to get this done?

Answer Source

This is kind of a hack, but I got it working by replacing git-bash.exe with my own one which gives -w max additional argument.

Here is the code for git-bash.exe.

#include "stdafx.h"
#include <stdlib.h>

int _tmain(int argc, _TCHAR* argv[])
{
    system("START /B D:\\program_files\\git\\Git\\usr\\bin\\mintty.exe -w max -o AppID=GitForWindows.Bash -o RelaunchCommand=\"D:\\program_files\\git\\Git\\git-bash.exe\" -o RelaunchDisplayName=\"Git Bash\" -i /mingw64/share/git/git-for-windows.ico /usr/bin/bash --login -i");
    return 0;
}

You have to change paths in above code to your own values if you need to build your own git-bash.exe from above code.

EDIT: If mintty is started with above code, it does not know the location of git binary. So I had to add the git bin directory to PATH variable.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download