Reputation: 5229
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:
Can I do the merge with automatically generating the commit?
Or can I add a command in the script to do a commit which accepts the default message?
Thanks!
Upvotes: 4
Views: 1946
Reputation: 3960
Another way:
git merge --squash someBranch
git commit -m ""
The --no-edit
option doesn't work for me (Git 2.7.0). It says: Squash commit -- not updating HEAD
.
Upvotes: 0
Reputation: 2030
It looks like in more modern versions of git, you can try using the --no-edit
option as described in the git-merge docs and in this SO question.
git merge --no-edit --squash someBranch
git push
Upvotes: 5
Reputation: 467311
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.
Upvotes: 5