After doing a merge and resolving conflicts, is there an "easy" way to just accept the default generated commit message from the command line? One of our developers will resolve all the conflicts, and then do a git commit -m"Merge Commit"
which replaces the generated commit message that listed all the conflict files. I would like to have a different flag that would just take the current file without modification. I know there is a -F or --file= option, but that requires knowing the file name all the time.
Thank you
For current Git versions (2020+), just do git rebase -i -r <parent> , then replace in the editor merge -C with merge -c . This will open the merge commit's message in the editor during rebasing, where you can change it (thanks to VonC for the hint).
Per the docs, I just tried this simple command and it worked for me:
git commit --no-edit
Afterward, run git log
to confirm that the default message has been used.
By default when a merge fails the commit message that was to be used is saved in a file in the git folder, usually .git/MERGE_MSG
. After the conflicts are resolved running git commit
will feed this saved message to the default editor.
If the message is not being picked up on its own it could be feed to the git command using the --file
option, which reads the commit message from a file:
git commit --file .git/MERGE_MSG
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With