I just squash and merged my PR with all the commit details which isn’t supposed to be done that way. I’d like to edit the commit message (details) on master so it doesn’t contain all that useless information. Also it is very annoying when hovering over a git blame in Intellij.
As is:
Commit name: Test
* commit 1
* commit 2
* commit 3
* ...
To be:
Commit name: Test
How do I do that either in terminal or in github web-client?
Thanks a lot!
>Solution :
You can use:
git checkout masterto switch over to the mastergit commit --amend -m "Commit name: Test"to edit the commit message of the latest commit (your merge commit)git push --force-with-leaseto forcefully push your rewritten history to the main branch.
I would recommend not doing any of that, because you will overwrite the current state of the master branch on your (presumably shared) repository.
Any person who would have already pulled master since you’ve merged your MR would then have a copy of some commits that you want to alter, and they’ll have to deal with your manipulated history as well.
I would suggest you let it go if there’s any chance that:
- anybody has already pulled from your MR
or - it’s okay to keep the merge-squash message as it is.