我有一个功能分支,已经有几个月了。我不断从上游/主人那里拔出来保持最新,我也经常在bitbucket上推送到origin / feature_branch_name。我的功能分支现已准备好进行代码审查。审稿人希望1次提交我的所有更改。我很熟悉交互式变基,但我不确定如何最好地实现这一目标。
答案 0 :(得分:2)
执行压缩合并可能更容易(也更快):
$ git checkout -b tmp upstream/master # Create a tmp branch (to do merging)
$ git merge --squash feature_branch_name # Merge in feature_branch_name as one commit
$ git checkout feature_branch_name # Switch to feature branch
$ git reset --hard tmp # Set tmp branch as feature_branch_name
$ git branch -d tmp # Delete tmp branch
$ git push -f # Push changes