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
The recorded tree is prepared as usual (including the effect of the -i and -o options and explicit pathspec), and the message from the original commit is used as the starting point, instead of an empty message, when no other message is specified from the command line via options such as -m, -F, -c, etc.
🌐
GitHub
github.com › git-guides › git-commit
Git Guides - git commit · GitHub
You may get carried away and end up solving two or three problems before you remember to commit! That's OK – Git can handle that. Once you're ready to craft your commits, you'll use git add <FILENAME> to specify the files that you'd like to "stage" for commit. Without adding any files, the command git commit won't work.
🌐
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 add hello.py to the Git staging area. We can examine the result of this action by using the git status command. 1git status 2On branch main 3Changes to be committed: 4 (use "git reset HEAD <file>..." to unstage) 5 new file: hello.py
🌐
Git Tower
git-tower.com › learn › git › commands › git-commit
git commit - Saving changes to the local repository | Learn Version Control with Git
Instead, you need to use the "git add" command to mark the desired changes for inclusion. Also note that in Git (not like in Subversion), a commit is not automatically transferred to the remote server. Using the "git commit" command only saves a new commit object in the local Git repository.
🌐
Conventional Commits
conventionalcommits.org › en › v1.0.0
Conventional Commits
types other than fix: and feat: are allowed, for example @commitlint/config-conventional (based on the Angular convention) recommends build:, chore:, ci:, docs:, style:, refactor:, perf:, test:, and others. footers other than BREAKING CHANGE: <description> may be provided and follow a convention similar to git trailer format.
🌐
Git
git-scm.com › cheat-sheet
Git Cheat Sheet
git show <commit> git diff <commit> <commit> git diff <commit> <file> git diff <commit> --stat git show <commit> --stat · Every time we say <commit>, you can use any of these: a branch · main · a tag · v0.1 · a commit ID · 3e887ab · a remote branch · origin/main ·
Find elsewhere
🌐
GitLab
docs.gitlab.com › tutorials › make_first_git_commit
Tutorial: Make your first Git commit | GitLab Docs
Git keeps track of changed files. To confirm which files have changed, get the status. ... 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")
🌐
DataCamp
datacamp.com › tutorial › git-commit-message
Git Commit Message: The Rules, Examples, and Conventions | DataCamp
January 27, 2026 - This comprehensive guide teaches you how to use git commit --amend to correct mistakes, add forgotten changes, and manage Git history. ... Learn how to use git diff to track code changes effectively, from basic comparisons to advanced techniques.
🌐
Microsoft Learn
learn.microsoft.com › en-us › visualstudio › version-control › git-make-commit
Make a Git commit in Visual Studio | Microsoft Learn
2 weeks ago - Just enter your commit message and then select Commit All. The equivalent command for this action is git commit -a.
🌐
TheServerSide
theserverside.com › video › Follow-these-git-commit-message-guidelines
Git commit message conventions and best practices | TheServerSide
Example git commit message from the Hibernate project on GitHub. In terms of format, capitalize the first letter of the subject line but don't force unnecessary capitalization anywhere else.
🌐
cbeams
cbea.ms › git-commit
How to Write a Git Commit Message - cbea.ms
May 27, 2023 - Imperative mood just means “spoken or written as if giving a command or instruction”. A few examples: ... Each of the seven rules you’re reading about right now are written in the imperative (“Wrap the body at 72 characters”, etc.). The imperative can sound a little rude; that’s why we don’t often use it. But it’s perfect for Git commit subject lines.
🌐
GitKraken
gitkraken.com › home › learn › learn git: commit
Git Commit - How to Git Commit | Learn Git
March 24, 2021 - In this example, after the git ... changes in the CLI, you will need to stage the changes with the git add command, followed by the name of the file....
🌐
Linux Kernel
kernel.org › pub › software › scm › git › docs › git-commit.html
git-commit(1) Manual Page
November 24, 2025 - For example, git commit --amend --no-edit amends a commit without changing its commit message. ... Replace the tip of the current branch by creating a new commit. The recorded tree is prepared as usual (including the effect of the -i and -o options and explicit pathspec), and the message from the original commit is used as the starting point, instead of an empty message, when no other message is specified from the command line via options such as -m, -F, -c, etc.
🌐
GeeksforGeeks
geeksforgeeks.org › git › what-is-git-commit
Git Commit - GeeksforGeeks
February 27, 2026 - Ways to Use the git commit Command explains the different methods and options available for creating commits in Git.
🌐
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.
🌐
GitHub
github.com › kitsuyaazuma › gommit
GitHub - kitsuyaazuma/gommit: A CLI tool that provides commit messages for the git commit command in an easy-to-understand, uniform format · GitHub
Just use gommit instead of git commit -m. ... # Install go install github.com/Kitsuya0828/gommit # Usage git add . gommit git push # Uninstall go clean -i -n github.com/Kitsuya0828/gommit · spf13/cobra: A Commander for modern Go CLI interactions · manifoldco/promptui: Interactive prompt for command-line applications
Author   kitsuyaazuma
🌐
Graphite
graphite.com › guides › how-to-use-git-commit-m-command
How to use the git commit -m command - Graphite
This guide covers the basics of using the `git commit -m` command, including variations and best practices.