0

created a local branch, made several commits, merged the branch to master, then pushed to the remote master. why do the commit history in my local branch is also shown up in the remote master? is there any way to delete these commit messages?

upout
  • 19
  • 1

3 Answers3

1

You got two options:

  1. Squash all of your history into a single commit before pushing.

git merge --squash branchName

  1. Amend your commit every single time you commit.

git commit --amend -m "New commit message"

Prem
  • 51
  • 4
0

When you merge you are merging all history. If you want to have a single commit use

 git merge --squash branchName

This will squash all of your history into one commit which is added to master

exussum
  • 18,275
  • 8
  • 32
  • 65
0

That is expected behavior as you commit history is retained in case you want to go away with that then you can use git rebase -i to collapse all commits into one commit and re-write the commit message thereafter send it to upstream branch then merge the branch to master

git rebase -i master
recursion
  • 354
  • 6
  • 11