[英]GIT: how to squash several commits that have been pushed to a remote repo?
[英]How to squash 7 pushed commits into one in to 1 in git?
git reset --soft HEAD~7
git add --all
git commit
git push --force
首先,将git index重置为要压缩的提交之前。 使用--soft
以便git只重置索引并且不会触及您的工作目录。 然后像往常一样创建一个提交。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.