To save your commit message and exit your text editor, follow these steps:
Type your commit message as usual.
Press ESC to exit insert mode.
ESC
Type :wq (which stands for write and quit) and press Enter.
:wq