DEV Community

Cover image for How to change the default editor in git for beginners
Abdelrahman hassan hamdy
Abdelrahman hassan hamdy

Posted on

How to change the default editor in git for beginners

When you decide to use a version control system (VCS) into your project using git And start creating the project
folder and writing the first commands,

Creating the first Repository
$ git init
Enter fullscreen mode Exit fullscreen mode

Alt Text

Now we need to add our file into the Repository

$ git add test_code.js
Enter fullscreen mode Exit fullscreen mode

Alt Text

Now the test_code.js file in the Staging area ( Index )

To get the status of our working tree
$ git status
Enter fullscreen mode Exit fullscreen mode

Alt Text

The last step we need to run $ git commit to captures a snapshot of the project's currently staged changes.

$ git commit
Enter fullscreen mode Exit fullscreen mode

Alt Text

Then the default text editor will run you need to write i letter to start typing the commit message and once you have done you need to click on esc button and input :wq to save and quite ,

Alt Text

Here's the problem if you didn’t familiar with the default Vim or nano text editor you need to add this command to use your favourite text editor,
$ git config --global core.editor "Atom"
i'll use Atom as a text editor.

finally Run this command git commit --amend to recover the commit message by input R then press Enter and run the $ git commit again

Alt Text

Alt Text

Good Luck and Happy Learning

Top comments (0)