添加“Git Bash Here”到右键菜单

之前安装了git的时候,清晰的记得右键菜单里是有“Git Bash Here”这个选项的,非常方面。后来不知道为啥突然没有了,就像搞回来。

  • 打开注册表,定位到HKEY_CLASSES_ROOT\Directory\Background\shell(如果Background下面没有shell目录,就自己新建一个)。
  • 在shell下右键-新建项,其名称为“Git Bash Here”,此为右键菜单显示名称(也可以将该项命名为Git,然后在该项的默认值中填上“Git Bash Here”,也能在右键菜单显示出来“Git Bash Here”)。
  • 在shell下右键-新建-字符串,命名为Icon,双击编辑,其值为“Git安装目录\mingw64\share\git\git-for-windows.ico”。此为菜单加图标。
  • 在Git Bash Here下右键-新建-项,命名为command,其值为”Git安装目录\bin\bash.exe” –login -i。假如不喜欢这个bash的风格,还可以指定另外一个bash,此时,command的值为”D:\DevelopTools\Git\git-bash.exe” (无需 –login -i参数)

此时,在任何一个目录空白处右键,即可出现Git Bash Here选项,单击即可进入bash并在bash中自动进入当前目录。考虑到PowerShell右键选项需要按住Shift才会在右键菜单中显示出来,想把Git Bash Here也搞成这样子。只需这样操作:

  • 在Git Bash Here 下右键-> 新建字符串,命名为“Extended”(与Icon字段同级)即可。

enjoy it。

猜你喜欢

转载自blog.csdn.net/johnnymartin/article/details/80802425