

If new files are added the -a option will not stage those new files. This option automatically stages all modified files to be committed. The -a OptionĪnother popular option is the -a option. NOTE: If the -m is not included with the git commit command, you will be prompted to add a message in your default text editor - see ‘Using detailed commit messages’ below. The output in your terminal should look something like this: My message The message should be at the end of the command and it must be wrapped in quotations " ".Īn example of how to use the -m option: git commit -m "My message"

The message should be a short description of the changes being committed. When calling git commit, it is required to include a message. The most common option used with git commit is the -m option. For an extensive list of options, please consult the Git documentation. However, this guide will only cover the two most common options. There are a number of options that you can include with git commit. This is one of the benefits of using Git over a tool like Dropbox or Google Drive. if multiple commits edit different parts of the project, they will not overwrite each other even if the authors of the commit were unaware of each other.you can recall the commited changes at a later date, or revert the project to that version ( see Git checkout).You can think of a commit as a snapshot of your project, where a new version of that project is created in the current repository. The git commit command will save all staged changes, along with a brief description from the user, in a “commit” to the local repository.Ĭommits are at the heart of Git usage.
