When you run git commit with no arguments, it will open your default editor to allow you to type a commit message. Saving the file and quitting the editor will make the commit.

It looks like your default editor is Vi or Vim. The reason "weird stuff" happens when you type is that Vi doesn't start in insert mode - you have to hit i on your keyboard first! If you don't want that, you can change it to something simpler, for example:

git config --global core.editor nano

Then you'll load the Nano editor (assuming it's installed!) when you commit, which is much more intuitive for users who've not used a modal editor such as Vi.

That text you see on your screen is just to remind you what you're about to commit. The lines are preceded by # which means they're comments, i.e. Git ignores those lines when you save your commit message. You don't need to type a message per file - just enter some text at the top of the editor's buffer.

To bypass the editor, you can provide a commit message as an argument, e.g.

git commit -m "Added foo to the bar"
Answer from Ben James on Stack Overflow
🌐
Git
git-scm.com › docs › git-commit
Git - git-commit Documentation
Let the user further edit the message taken from <file> with -F <file>, command line with -m <message>, and from <commit> with -C <commit>. ... Use the selected commit message without launching an editor. For example, git commit --amend --no-edit amends a commit without changing its commit message.
🌐
W3Schools
w3schools.com › git › git_commit.asp
Git Commit
You can always go back to a previous commit if you need to. ... git commit -m "First release of Hello World!" [master (root-commit) 221ec6e] First release of Hello World!
🌐
Atlassian
atlassian.com › git › tutorials › saving-changes › git-commit
Git Commit | Atlassian Git Tutorial
This command will open up the system's configured text editor and prompt to change the previously specified commit message. The following example assumes you’ve edited some content in a file called hello.py on the current branch, and are ready to commit it to the project history. First, you need to stage the file with git ...
🌐
GitHub
github.com › git-guides › git-commit
Git Guides - git commit · GitHub
You can also use a handy command, git add -p, to walk through the changes and separate them, even if they're in the same file. git commit: This starts the commit process, but since it doesn't include a -m flag for the message, your default text editor will be opened for you to create the commit message.
🌐
Git Tower
git-tower.com › learn › git › commands › git-commit
git commit - Saving changes to the local repository | Learn Version Control with Git
The actual commit command will then wrap up the mentioned changes in a new commit object: git add index.html css/styles.css git commit -m "Change titles and styling on homepage" If you have lots of changed files in your working copy - and want all of them included in the next commit - you can make use of the "-a" parameter and thereby omit the "git add" step: git commit -a -m "Change titles and styling on homepage" The "--amend" option comes in handy, for example, when you mistyped the last commit's message or forgot to add a change.
🌐
GitKraken
gitkraken.com › home › learn › learn git: commit
Git Commit - How to Git Commit | Learn Git
March 24, 2021 - Adding a Git commit message should look something like this: git commit -m “Add an anchor for the trial end sectionnn.” ... Now, if you can see from the example above, there is a typo in the last word.
Find elsewhere
🌐
GitLab
docs.gitlab.com › tutorials › make_first_git_commit
Tutorial: Make your first Git commit | GitLab Docs
... On branch example-tutorial-branch Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git restore <file>..." to discard changes in working directory) modified: README.md no changes added to commit (use "git add" and/or "git commit -a")
🌐
GeeksforGeeks
geeksforgeeks.org › git › what-is-git-commit
Git Commit - GeeksforGeeks
February 27, 2026 - Note: Does not include untracked files-you still need git add for those. ... Modify the last commit’s message or add new staged changes. Useful for correcting mistakes in the most recent commit.
🌐
GeeksforGeeks
geeksforgeeks.org › git › committing-in-git
Committing in Git - GeeksforGeeks
1 month ago - You can then specify the file names in the commit command. git commit file_name1 file_name2 -m "commit_message" This commits the staged changes only for the specified files. ... You can specify a custom date for a commit so that it appears with ...
🌐
Git
git-scm.com › cheat-sheet
Git Cheat Sheet
git commit · git commit -m 'message' git commit -am 'message' git switch <name> OR git checkout <name> git switch -c <name> OR git checkout -b <name> git branch · git branch --sort=-committerdate · git branch -d <name> git branch -D <name> git diff HEAD ·
🌐
Career Karma
careerkarma.com › blog › git › git commit
Git Commit: an important part of the Git version control system.
December 1, 2023 - Here is the syntax for using the ... in quotation marks following the -m flag. In this case, our commit message is “feat: commit message”. Let’s walk through an example ......
🌐
GitLab
docs.gitlab.com › topics › git › commands
Common Git commands | GitLab Docs
$ git blame -L 5, 5 example.txt 123abc (Zhang Wei 2021-07-04 12:23:04 +0000 5) Use git bisectto use binary search to find the commit that introduced a bug.
🌐
Linux Kernel
kernel.org › pub › software › scm › git › docs › git-commit.html
git-commit(1) Manual Page
November 24, 2025 - The default can be changed by the ... <commit> with -C <commit>. ... Use the selected commit message without launching an editor. For example, git commit --amend --no-edit amends a commit without changing its commit message....
🌐
freeCodeCamp
freecodecamp.org › news › git-commit-command-explained
Git Commit Command Explained
December 29, 2019 - The most common option used with git commit is the -m option. The -m stands for message. When calling git commit, it is required to include a message. The message should be a short description of the changes being committed. The message should be at the end of the command and it must be wrapped in quotations " ".
🌐
BitDegree
bitdegree.org › learn › git-commit-command
Learn How to Commit to Git: Git Commit Command Explained
January 30, 2018 - The following example pushes changes even if it does not end in a non-fast-forward merge. Beginners should not use this option: ... Note: the Git push command makes sure that you share your changes with remote colleagues. The Git committing process requires several steps: moving changes to the staging area and saving them with the commit command.
🌐
DataCamp
datacamp.com › tutorial › git-commit
Git Commit Tutorial: How to Track and Document Code Changes | DataCamp
March 25, 2025 - The simplest way to create a commit is by using the following command: ... Here, the -m flag allows you to include a short commit message describing the changes. This is where you provide context for future reference and collaboration, for example: git commit -m “Fix bug in user authentication”
🌐
CodingNomads
codingnomads.com › git-commit
Git Commit
Learn about the Git Commit command, including the commands for Git Commit Message, Git Commit: `-a`, Git: Change Commit Message, Git Help, and Git Log.
🌐
Intellipaat
intellipaat.com › home › blog › git commit explained: what it does, how to use it, and tips
Git Commit Command Explained: Usage, Examples, and Tips
October 31, 2025 - Learn how the git commit command works, step-by-step examples, key options like -m and --amend, and tips for clean commit history. Includes tips for beginners and pros.