git commit --commit

Use the "git commit" command to commit the prepared file Use the "-m" option to enter the comment directly.

#Enter a comment directly to commit
git commit -m "comment"

#Open the comment in an editor such as vi, write it, and then commit
git commit

Commit comments describe the content of source code changes.

Before you can commit, you need to be ready to commit. Use the " git add" command to prepare for commit.

If you open it with vi editor, write a comment and use "Esc" to switch to command mode and "wq". And press Enter.

What is a commit in Git?

A commit in Git is the state of a file and directory at some point in time. It is identified by a 40-digit commit ID.

#Commit ID
6b984517092ca6dd61faa7938c136aa468ba6c44

Once you know the commit ID, you can revert the files and directories back to that state.

Git has information about the differences between files and directories between individual commits, and by stacking them from the first commit, it restores the state of the files and directories at some point in time.

Does the commit ID conflict?

Since the commit ID is the value of the SHA1 hash function, it is possible to collide, but since it is an astronomically small probability, it is probably okay for practical use. Even if it hits, you should be able to avoid it by making a slight change to the source code, such as "adding a blank".

Associated Information