[英]why commit messages in local branch show up in master commit history after merged to master?
created a local branch, made several commits, merged the branch to master, then pushed to the remote master. 创建一个本地分支,进行几次提交,将该分支合并到master,然后推送到远程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? 有什么办法可以删除这些提交消息?
You got two options: 您有两种选择:
git merge --squash branchName
git commit --amend -m "New commit message"
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 这会将您的所有历史记录压缩为一次提交,该提交已添加到master中
这是预期的行为,因为保留了提交历史记录以防万一,然后可以使用git rebase -i将所有提交折叠为一个提交并重新编写提交消息,然后将其发送到上游分支,然后合并分支掌握
git rebase -i master
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.