参考:
[转] git merge 将多个commit合并为一条之--squash 选项
git checkout master git pull origin master # 本地先拉取最新的master,最后目标是要merge到master git branch feature-123-merge # 从master创建一个新的专门用来做merge的新branch:feature-123-merge git checkout feature-123-merge git merge --squash feature-123 # 这里把原来有n多commit的feature-123的branch合并到feature-123-merge git commit -m "feature-123: A test change for merging with squash" # commit一次,然后push git push origin feature-123-merge:feature-123-merge # 这时候在服务器上的feature-123-merge就只有最新的这一次commit,可以pull request再merge到master了
原文地址:https://www.cnblogs.com/pekkle/p/12071849.html
时间: 2024-10-07 23:31:30