Skip to content

Instantly share code, notes, and snippets.

@rupakraj
Created December 5, 2016 04:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rupakraj/d6678370f5304848ac9caccf4e4bffc8 to your computer and use it in GitHub Desktop.
Save rupakraj/d6678370f5304848ac9caccf4e4bffc8 to your computer and use it in GitHub Desktop.
Bring git on context menu of working directory
It assumes your bash installation is from Git Bash for Windows from git's official downloads.
cmd /c (start /b "%cd%" "C:\Program Files\Git\git-bash.exe") && exit
I ended up using this after I lost my context-menu items for Git Bash as my command to run from the registry settings. In case you're curious about that, I did this:
Create a new key called Bash in the shell key at HKEY_CLASSES_ROOT\Directory\Background\shell
Add a string value to Icon (not a new key!) that is the full path to your git-bash.exe, including the git-bash.exe part. You might need to wrap this in quotes.
Edit the default value of Bash to the text you want to use in the context menu enter image description here
Add a sub-key to Bash called command
Modify command's default value to cmd /c (start /b "%cd%" "C:\Program Files\GitW\git-bash.exe") && exit enter image description here
Then you should be able to close the registry and start using Git Bash from anywhere that's a real directory. For example, This PC is not a real directory.
*Source:* http://stackoverflow.com/questions/19916670/how-to-launch-a-git-bash-window-with-particular-working-directory-using-a-script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment