Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Does Git Merge not Auto-generate a Commit and Commit Message?

Tags:

git

git-merge

I am trying to learn branching and merging in git. I thought that merging 2 branches automatically generates a merge commit and message (which I regard as a good thing). I DO want a commit and a commit message automatically generated, preferably with the ability to edit the commit message.

I made a "test" branch, deleted two non-critical files, commited, and then merged test back into master. I do not get a commit or a commit message for the merge; instead HEAD (on master) becomes the last commit from the test branch.

Am I doing something wrong? Is there a way of forcing it to automatically generate a commit with each merge, preferably allowing me to edit the commit message?

Thanks.

like image 566
haziz Avatar asked Jan 29 '26 06:01

haziz


1 Answers

You can use git merge --no-ff to avoid performing a fast-forward merge and thus always creating a merge commit.

like image 70
ThiefMaster Avatar answered Jan 30 '26 20:01

ThiefMaster



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!