I am trying to enter the Git commit message in the editor which looks like Vi, but none of commands like :wq, Esc etc. are working. Whenever I try to mer         
        
It looks like to be Joe
From what I know to save and exit you must type ^kx (where ^ is equal to CTRL).
If you want to change default Git's editor, just update the EDITOR variable, in your ~/.bashrc by example:
export EDITOR="vim"
                                                                        The (fundamental) line is a hint that this is some kind of Emacs: Fundamental mode is one of the Major Modes of Emacs.
This is the documentation for the basic usage of Emacs: