Command to open file with git

后端 未结 18 1320
滥情空心
滥情空心 2021-01-30 04:05
  • I have sublime text as the default editor in git (and it works)
  • git config --edit opens the config file in sublime text (Awesome)
18条回答
  •  死守一世寂寞
    2021-01-30 05:04

    I found a workaround for this via this link. In a nutshell, you have to:

    1. Create a file named subl (or any name you'd like for the command to call for Sublime Text) without extension
    2. Put this command inside the above file(Replace the path for executable if necessary):

      #!/bin/sh
      "C:\Program Files\Sublime Text 2\sublime_text.exe" $1 &
      
    3. Place that subl file inside the adequate command directory according to your OS and Sublime Text version (If you have doubts, check the above link comments section). In my case, I'm using Sublime Text 3 with Windows 10 64bit so I placed it in:

      C:\Program Files (x86)\Git\usr\bin
      
    4. Now, in order for you to open the desired file, in git bash use (within file folder)

      subl filename
      

提交回复
热议问题