This post will cover how to set the default text editor used by git or mercurial via the command line. The default text editor is used whenever the version control system requires us to enter a message, like a commit message.
Although we will set the editor from the command line on Linux and Windows bear in mind that for Linux the best way to set the preferred text editor is using environment variables. Both version control systems will check the
$(EDITOR) Linux environment variables (in that order of precedence) if no editor has been set. As they control the default text editor for the OS it makes sense to stick to just using those but we will still cover how to set via the command line as an example.