5

I am trying to commit all my changes by using following command

git commit -a

Note : I want to commit without any "commit message"

but when I execute above command it shows me the screen shown below, and I don't know how to get out of this screen to complete my commit.

enter image description here

Willian Mitsuda
  • 1,249
  • 1
  • 12
  • 14
Tahir Yasin
  • 11,489
  • 5
  • 42
  • 59

4 Answers4

3

You must specify a commit message with each commit. There are two ways to do this. First, you can provide it on the command line, using the -m switch:

git commit -am "I made the changes"

If you don't specify that switch, git opens the configured editor. By default, this is vim. To write the message in vim, type i to enter insert mode, then type your message. Hit esc to exit insert mode, then type :wq to save (write) and quit the editor.

You can also configure another editor to be used by git. On the command line, you can run a command like git config --global core.editor notepad, where notepad is the name of the editor that you prefer.

Community
  • 1
  • 1
bdukes
  • 152,002
  • 23
  • 148
  • 175
  • is there a way to commit without message? – Tahir Yasin Oct 31 '12 at 13:57
  • No, there is no way to commit without a message. Commits require a message. It can be something as simple as 'Changed 4 files', or 'Another update'. That said, having meaningful commit messages is _really_ helpful to make sense of source control when you come back to a project later (even a couple of days later). – bdukes Oct 31 '12 at 18:06
2

try git commit -a -m '[your commit message]'

edit: git need always a comment for each commit, you can by the way add an empty comment with

git commit -a -m ''

or

git commit -am ''

Committing with a message is necessary when using Git, but is also helpful:

Crafting the commit message is a very important step of your development work. The message is usually the first thing other developers will see, and the first line in a Git commit-msg has a special meaning. It is considered the "Title" or "Subject" of the commit. Many interfaces use this title to represent the commit, such as:

-Subject of e-mail notifications

-git log's "oneline" mode

-Gerrit interface (dashboard, search results, title)

-Git revert (cites the commit title)

-Various Git GUI clients

(use first line as title until first empty line or end of body)

dnlcrl
  • 5,022
  • 3
  • 32
  • 40
0

u should use git commit -a -m '[your message here]'

a commit message is necessary you can keep it empty as well

git commit -a -m ''

a correlated question

Git commit with no commit message

Community
  • 1
  • 1
Rishabh
  • 1,185
  • 1
  • 12
  • 28
0

You haven't specified commit message so Git opened default editor (Vim in this case) to specify message. You have 2 options to solve this:

  1. Write your message writeing

    i{your message}<ESC>:wq<CR>
    
  2. Or write message directly into command line:

    git commit -am 'your message'
    
Hauleth
  • 22,873
  • 4
  • 61
  • 112