You were thrown into your default editor, most likely vi. git config --global core.editor nano is probably more useful and easier to navigate for you. Answer from Deleted User on reddit.com
🌐
Reddit
reddit.com › r/git › can't enter commit message in git after merging branch. any advice?
r/git on Reddit: Can't enter commit message in Git after merging branch. Any advice?
July 25, 2022 -

Whenever I try to merge a branch, I get the following screen prompting me to add a message. When I try to add a message I can only use up and down keys and I can't enter any text. Also, I'm not sure how to submit it so that the screen prompt goes away and back to the normal terminal. Any help would be appreciated, thanks.

🌐
Brandon Pugh's Blog
brandonpugh.com › posts › tips for creating merge commits
Tips for creating merge commits | Brandon Pugh's Blog
August 31, 2024 - This could be something like “Merging in updated auth flow” or “Merging in changes to sharedService to avoid conflicts”. This also implies that you should have a reason for the merge — which I agree with because otherwise you’re adding unnecessary noise to the git log. At the very least make it clear that it’s a merge commit. Don’t just put something like update database migrations — if you did have to do that as a result of the merge then mention it in the body of the message (though as I’ll explain shortly, it should go in a followup commit).
Discussions

version control - git: merge branch and use meaningful merge commit message? - Stack Overflow
But I'd like to use the original commit messages from my feature branch in this commit instead of "merge branch XXX". ... Save this answer. ... Show activity on this post. Just pass the -m and --no-ff parameters to the merge command: $ git merge other-branch -m "Commit Message" --no-ff More on stackoverflow.com
🌐 stackoverflow.com
How to exit a git merge asking for commit message? - Unix & Linux Stack Exchange
I'm using git. I did a normal merge, but it keeps asking this: # Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic br... More on unix.stackexchange.com
🌐 unix.stackexchange.com
Merge commit message with list of commits
How can I setup merge requests such that the merge commit message automatically has the list of commits it is merging from the source branch? Eg: Merge message heading More information about merge List: * Commit message last ... * Commit message first branching point This is more important ... More on forum.gitlab.com
🌐 forum.gitlab.com
1
0
October 3, 2018
Can't enter commit message in Git after merging branch. Any advice?
You were thrown into your default editor, most likely vi. git config --global core.editor nano is probably more useful and easier to navigate for you. More on reddit.com
🌐 r/git
3
5
July 25, 2022
🌐
Git
git-scm.com › docs › git-merge
Git - git-merge Documentation
Then git merge topic will replay the changes made on the topic branch since it diverged from master (i.e., E) until its current commit (C) on top of master, and record the result in a new commit along with the names of the two parent commits and a log message from the user describing the changes.
Top answer
1 of 6
129

Just pass the -m and --no-ff parameters to the merge command:

$ git merge other-branch -m "Commit Message" --no-ff

The --no-ff parameter is required to prevent merging as a fast-forward without merge commit.

2 of 6
20

You basically have two option.

Easy solution: don't merge, Rebase
Rebase your branch on top of the main branch, resolve conflict, and then merge. As you'll have a straight history, you'll be able to fast-forward to merge and this won't create any merge commit.

git checkout feature
git rebase main
# Resolve conflict if there is
git checkout main
git merge feature

Second option: Rebase -i
You can edit your history after your merge (before you push to a remote). You can manage this with rebase interactive mode.

git checkout main
git merge feature
#You merge and resolve conflict
git rebase -i <sha of the commit before the merge>

Then you'll be taken into an interactive shell with the list of the commits, e.g.:

pick 73c991e Create progress bar module
pick b8a0b83 merge branch feature
pick 2120f47 Add user form
pick 70c55e4 Quiz prototype system

You just need to add squash or s instead of pick:

pick 73c991e Create progress bar module
pick b8a0b83 merge branch feature
s 2120f47 Add user form
pick 70c55e4 Quiz prototype system

This command would squash together b8a0b83 and 2120f47. The next step will be a commit text editor where you have both commit message combined, and it's now up to you to edit them correctly to only keep your original message.

🌐
GitHub
github.com › orgs › community › discussions › 5955
Merge commit message template · community · Discussion #5955
Since the commit message (its synax, wording, title, description, existing trailers) is important, we do not want to modify it other than append to it. It is a built in function of Git to be able to add new trailers using git interpret-trailers. One solution is to look at this process even more abstract, and offer the ability to mark the PR as merged as opposed to closed if we can program systematic merging.
🌐
W3Schools
w3schools.com › GIT › git_branch_merge.asp
Git Branch Merge
This is useful for cleaning up commit history before merging. git merge --squash feature-branch Squash commit -- not updating HEAD Automatic merge went well; stopped before committing as requested
Find elsewhere
🌐
GitLab
docs.gitlab.com › user › project › merge_requests › commit_templates
Commit message templates | GitLab Docs
GitLab uses commit templates to create default messages for specific types of commits. These templates encourage commit messages to follow a particular format, or contain specific information. Users can override these templates when merging a merge request.
🌐
Microlinux
formations.microlinux.fr › git › merge-commit
Git par la pratique - Le merge commit - Formations Linux
Merge branch 'hello-figlet' # Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit. ... Nous avons vu lors de l'atelier pratique sur la configuration de Git que c'est l'éditeur Vim qui est lancé par défaut, à moins que vous n'ayez explicitement configuré un autre éditeur comme Nano.
🌐
Git
git-scm.com › book › en › v2 › Git-Branching-Basic-Branching-and-Merging
Git - Basic Branching and Merging
Merge branch 'iss53' Conflicts: index.html # # It looks like you may be committing a merge. # If this is not correct, please remove the file # .git/MERGE_HEAD # and try again. # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message ...
🌐
Microsoft Learn
learn.microsoft.com › en-us › visualstudio › version-control › git-manage-repository
Manage Git repos in Visual Studio | Microsoft Learn
May 22, 2026 - To learn more about amending, including how to change commit messages other than the most recent one, see Git Tools - Rewriting History on the Git website. To merge a series of commits, Git provides an option to squash commits down into a single commit.
🌐
GitKraken
gitkraken.com › home › learn › learn git: commit
Git Commit - How to Git Commit | Learn Git
March 26, 2026 - Learn how to Git commit in the CLI, including how to add a Git commit message and how to amend a commit. Then, see how to revert a commit with the GitKraken Git GUI.
🌐
Conventional Commits
conventionalcommits.org › en › v1.0.0
Conventional Commits
A common workflow for this is to have your git system automatically squash commits from a pull request and present a form for the lead maintainer to enter the proper git commit message for the merge.
🌐
Visual Studio Code
code.visualstudio.com › docs › sourcecontrol › overview
Source Control in VS Code
November 3, 2021 - Type your commit message in the input box or select the sparkle icon () in the commit message input box to use AI to generate a commit message based on your staged changes. Learn more about staging changes and writing commits.
🌐
Git
git-scm.com › docs › merge-options › 2.22.1
no-commit - Git - merge-options Documentation
GPG-sign the resulting merge commit. The keyid argument is optional and defaults to the committer identity; if specified, it must be stuck to the option without a space. ... In addition to branch names, populate the log message with one-line descriptions from at most <n> actual commits that ...
🌐
GitLab
forum.gitlab.com › how to use gitlab
Merge commit message with list of commits - How to Use GitLab - GitLab Forum
October 3, 2018 - How can I setup merge requests such that the merge commit message automatically has the list of commits it is merging from the source branch? Eg: Merge message heading More information about merge List: * Commit message last ... * Commit message first branching point This is more important to me if we’re squashing the commits because otherwise the commit messages are visible in the history tree.
🌐
Tbaggery
tbaggery.com › 2008 › 04 › 19 › a-note-about-git-commit-messages.html
tbaggery - A Note About Git Commit Messages
April 19, 2008 - The subject line is used all over Git, oftentimes in truncated form if too long of a message was used. The following are just a handful of examples of where it ends up: git log --pretty=oneline shows a terse history mapping containing the commit id and the summary · git rebase --interactive provides the summary for each commit in the editor it invokes · if the config option merge.summary is set, the summaries from all merged commits will make their way into the merge commit message
🌐
Graphite
graphite.com › guides › how-to-squash-git-commits
How to squash Git commits
Git squash refers to the process of combining multiple commit messages and changes into one. This is usually done via an interactive rebase, which allows you to consolidate commits in a way that maintains a clean and understandable project history.
🌐
Git
git-scm.com › docs › git-commit
Git - git-commit Documentation
The changes staged for hello.c and hello.h are not included in the resulting commit. However, their changes are not lost — they are still staged and merely held back. After the above sequence, if you do: ... After a merge (initiated by git merge or git pull) stops because of conflicts, cleanly merged paths are already staged to be committed for you, and paths that conflicted are left in unmerged state.