What is a git commit command?

Experience Level: Junior
Tags: Git Source control

Answer

When you execute the git commit command from the command line, the staged changes from your Staging Area (Index) will be sent to your local repository.

In any version control system it has always been a good practice to append a message with description of changes that are included in the commit. In Git it can be done using the following command:

git commit -m "Something has changed"

If you omit the -m parameter with description of changes, the Git will automatically display the default editor and will let you enter the commit message using the editor. The command looks like this:

git commit

Related Git job interview questions
Git for beginners
Git for beginners

Are you learning Git? Try our test we designed to help you progress faster.

Test yourself