0

I am new to GIT and trying to do some of its basic operations, working with Windows.

I am successfully able to add a new file using command:- git add "filename.txt" When I try to commit is using command:-- git commit "filename.txt" , a new editor window opens and there I add the commint message. I am not able to come out of it. If I do ctrl+c, I get to the start point but changes are not committed.

I do not want to use -m to add message.

How can I save the added message in the editor window?

2 Answers2

0

Every commit needs a log entry. You probably need to type a reason for the commit such as "first commit" in the popup window.

You can choose your text editor and it sounds like you haven't set your editor.

If it's vi that is popping up, you use i to insert, and escape :wq! to write to file.

taco
  • 1,367
  • 17
  • 32
  • Seems you havent read my problem completely. If I do not give the -m flag, editor window opens and there I am giving complete message,but how to come out of the editor window? –  Sep 08 '14 at 02:57
  • It sounds like you haven't set your editor. I've updated my answer. – taco Sep 08 '14 at 03:03
  • @Mixie no problem. Please mark my answer as the solution, so I can get points. – taco Sep 08 '14 at 03:29
  • Can you also tell me how to change the default editor. Thank You –  Sep 08 '14 at 06:02
  • @Mixie see http://stackoverflow.com/questions/10564/how-can-i-set-up-an-editor-to-work-with-git-on-windows – taco Sep 08 '14 at 14:48
0

If you haven't customize anything, it's probably a VI editor. After you enter the comments, and just save and exit like it's in VI.

ESC -> :wq -> Enter

If not, you may try to save and exit in the editor's way.

Landys
  • 7,169
  • 3
  • 25
  • 34