What is a git commit command?
Experience Level: Junior
Tags: GitSource 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
What does the Git clone command do?
GitSource control JuniorHow do you add a new file to the Git remote repository?
Git JuniorHow can you identify who changed the specific file under version control and what were the changes?
GitSource control JuniorHow can you find out what were the most recent changes in Git repository and who made them?
GitSource control JuniorHow do you get changes from the remote repository to your computer?
GitSource control Junior