Quantcast
Channel: User Sourav Kannantha B - Stack Overflow
Viewing all articles
Browse latest Browse all 60

Is it possible to know which editor git is going to use programatically?

$
0
0

Is it possible to know which editor git is going to use programmatically? Something like this is possible?

$git which editor/usr/bin/nano

Basically, I wanted to invoke a custom editor only for git commit messages. So if file name is '.git/COMMIT_EDITMSG', I will invoke something else, otherwise I want to fallback to default git editor.

I know that git uses $GIT_EDITOR, core.editor, $VISUAL, $EDITOR in order to choose an editor. But all of these are not present, I don't know what to do. Here it says, it uses vi. But in my machine, it uses nano. Hence, it is not really reliable to hardcode that.

Hence, how to know which editor will git use programmatically? If not directly from git, is there any other workaround?


Viewing all articles
Browse latest Browse all 60

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>