1

I want to merge a branch in GIT and keep the COMMIT MESSAGE.

enter image description here

Not wanted: git merge --no-edit This keeps the default message: Merge branch 'master' into develop

Wanted: I want to copy the message: ACC-9187 Reformat code instead of the Merge branch ..... ==> The merge must contain the same message. Offcourse I don't want to type the whole message again...: not: git merge -m "ACC-9187 Reformat code"

==> Any suggestions? Thanks!

Dimitri Dewaele
  • 10,311
  • 21
  • 80
  • 127

1 Answers1

1

After the merge is done and before you make any new commit, run:

git commit --amend -C HEAD^2

If you want a single-line solution:

git merge master -m "$(git log -1 --pretty=%B master)"
ElpieKay
  • 27,194
  • 6
  • 32
  • 53