Lab 7: Git Commiting Changes

In this tutorial I will show you how to commit changes to the repository. The -m flag allows you to add a commit message in the command line. The git commit command allows you to interactively edit a comment for the commit. If you omit the -m flag from the command line, git will pop up the editor of your choice. The priority order for the editor is:
– GIT_EDITOR environment variable
– core.editor configuration setting
– VISUAL environment variable
– EDITOR environment variable

When you execute the git commit command, a editor is opened as shown below. In our case VIM editor popped up.
VIM editor

To add a comment in VIM, press i to get it in insert mode. When you are done adding the comment, press ESC and then type :wq! to save and quit VIM. The screenshot shows how it is done.

VIM Save and Quit

The git bash command line tool is reopened with commit command executed. You could use the git status command to check the status of the repository.

Git commit and check status

The working directory is clean and ready for you to continue.

This content has been helpful to you?

Thanks for contributing!

Yes No