Search code examples
gitshellsmartgit

Saving commit changes in shell


I have a Git repository ssh://git@x/y/, where I need to commit a file using Smartgit Shell. I've simply written the two lines below.

git add README
git commit

This opens a commit window (see below), where I simply uncomment the file README. However, how do I save the commit-file? Currently I'm stuck in this window.

enter image description here

I suppose I have to use some key combination?


Solution

  • The editor that launches is vim, which may be a bit confusing to people not used to it. It has an editing mode that you can start by pressing A and you can leave it again by pressing Esc.

    Once you are out of editing mode, you can enter :wq or just :x to save and exit the editor. This will make Git use the message for the commit.

    Note that you shouldn’t uncomment those lines. Everything below the “Please enter …” text is just a hint (lines starting with # are ignored) for you so you know what you are about to commit (what files were changed in the commit, which weren’t). Instead, you should just enter a message above it and then save/exit the editor.

    If you don’t want to bother with vim, you can also configure Git to use a different editor instead. There is also the gitpad project that allows you to use the default Windows notepad (or others) as a commit editor.