Use the text editor you're most comfortable with
Whether you installed Git yourself, or you’re using the version that came pre-installed on your OS, the default text editor will be Vim. Too often people leave this default and struggle through learning an un-intuitive text editor while they’re also trying to learn Git.
Even worse, some can’t distinguish Git from Vim, thinking that they’re one in the same; because for many, their first time running git commit
is also the first time they’ve seen Vim. The confusion of the text editor becomes muddled together with the confusion of learning Git, so they turn to a Git GUI tool and immediately lose so much of the power behind Git.
You can tell git to use whatever text editor you prefer. Then, when you run git commit
or git rebase -i
, instead of Vim opening in the terminal, your chosen text editor will pop up for you! You then edit the file, save the file, and close that window of your text editor.
Done! ✅
InstructionsSection titled: Instructions
The details change slightly depending on the text editor you want to use. I will provide info for several common text editors here.
Using VS Code as your Git editorSection titled: Using VS Code as your Git editor
- Open VS Code, open the command palette (cmd + shift + p), type code, and then select Shell Command: Install ‘code’ command in PATH.
- This will allow you to run
code
from the command line to open directories or files.
- This will allow you to run
- Then run:
Using Sublime Text as your Git editorSection titled: Using Sublime Text as your Git editor
Using Webstorm/IntelliJ as your Git editorSection titled: Using Webstorm/IntelliJ as your Git editor
- From the menu bar, choose
Tools -> Create Command-line Launcher
. Accept the default path. - Then run: