If at work you “have” to work with windows clients and are using linux shell-like tools like git, you probably know this problem:
You want to open a shell from the Windows File Explorer, then do some actions, change directories and then again open a Windows File Explorer from the shell at your current location.
You also might remember from OS X how comfortable it is, that you only have to type ‘open .’ to open a file explorer at the current shell-location. Or you want to open a git shell from the File Explorer?
Then you’re exactly right here. I’ll show you how to install an alias, which helps you to do exactly this.
Install an ‘open’ alias
Since on windows you can open a file explorer from the shell by typing ‘explorer.exe’, we’ll install a linux-alias, which does just that. Open the shell you’re using i.e. git for windows or cygwin or the like, then type the following:
$ cd $ echo alias open=\'explorer.exe\' >> .bashrc
Now, exit the shell, reopen it and you’re done. Now you can type the coommand ‘open .’, and an explorer should open at the very location.
Open git shell from Windows File Explorer
Now for the other way round. In older versions of git for windows, we had automatically installed window context-menu entries in the file explorer to open a git console at the very location of the file system. However, after instlaling git some weeks ago on a new laptop, this comfortable feature was missing.
Step 1. On your desktop right click “New”->”Text Document” with name OpenGitBash.reg
Step 2. Right click the file and choose “Edit”
Step 3. Copy-paste the code below, save and close the file
Step 4. Execute the file by double clicking it
Windows Registry Editor Version 5.00 ; Open files ; Default Git-Bash Location C:\Program Files\Git\git-bash.exe [HKEY_CLASSES_ROOT\*\shell\Open Git Bash] @="Open Git Bash" "Icon"="C:\\Program Files\\Git\\git-bash.exe" [HKEY_CLASSES_ROOT\*\shell\Open Git Bash\command] @="\"C:\\Program Files\\Git\\git-bash.exe\" \"--cd=%1\"" ; This will make it appear when you right click ON a folder ; The "Icon" line can be removed if you don't want the icon to appear [HKEY_CLASSES_ROOT\Directory\shell\bash] @="Open Git Bash" "Icon"="C:\\Program Files\\Git\\git-bash.exe" [HKEY_CLASSES_ROOT\Directory\shell\bash\command] @="\"C:\\Program Files\\Git\\git-bash.exe\" \"--cd=%1\"" ; This will make it appear when you right click INSIDE a folder ; The "Icon" line can be removed if you don't want the icon to appear [HKEY_CLASSES_ROOT\Directory\Background\shell\bash] @="Open Git Bash" "Icon"="C:\\Program Files\\Git\\git-bash.exe" [HKEY_CLASSES_ROOT\Directory\Background\shell\bash\command] @="\"C:\\Program Files\\Git\\git-bash.exe\" \"--cd=%v.\""