Command to open file with git

后端 未结 18 1329
滥情空心
滥情空心 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 04:38

    Brenton Alker above said 'start ' works -- I'll add a caveat to that: that works for all files that are already associated with sublime-text (as he says, it works as if they were double clicked in windows explorer).

    But if, for example, you wanted to open the .gitignore file from your shell into sublime_text, and .gitignore is not associated with sublime_text, here's what I did:

    I edited my PATH environment variable to contain the Sublime Text folder within program files, the one that holds sublime_text.exe. Now, in my terminal (I use powershell, but it works from any terminal), when I type 'sublime_text .gitignore' the .gitignore from my current directory opens in Sublime!

    I tried to make a .bat file called sublime.bat that would work so that I could just type sublime .gitignore, but that didn't work - it opened sublime text but not the file for some reason. I'm content with sublime_text (tab completion simplifies it for me, actually -- simply 'su[tab]' does the trick!

提交回复
热议问题