How to squash and rebase already pushed branch into master?

I have a branch x that was already pushed because there are more of us working on that feature. Now I would like to to rebase it on top of master and squash some commits.

My current workflow is:

git co x
git format-patch HEAD~28
git co master
git am 00*.patch
git rebase -i HEAD~28
git push
git push origin :x

I am pretty sure is much better workflow available. Because it is a git. Help, thanks.

Okay I found a solution using cherry-pick with a range:

git cherry-pick XXX..YYY

Feel free to add additional solutions, will upvote them all when appropriate ;-)

链接地址: http://www.djcxy.com/p/49048.html

上一篇: 尝试推送时出现Git错误

下一篇: 如何挤压和重新绑定已将分支推入主?