Search code examples
gitmergecommitsquash

Accept default git commit message after a squashed merge


I would like to do the following in a script:

git merge --squash someBranch
git push

The problem is that the merge does not do a commit. So before the push I have to commit. The default commit message created by this merge is sufficient. So my questions are:

  1. Can I do the merge with automatically generating the commit?

  2. Or can I add a command in the script to do a commit which accepts the default message?

Thanks!


Solution

  • The default commit message after a merge is in .git/MERGE_MSG, so you could do the following:

     git commit -F .git/MERGE_MSG
    

    ... after the merge.