如何一次挤压/变基 [英] How to squash/rebase in a single shot

查看:22
本文介绍了如何一次挤压/变基的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎样才能以最小的努力,将我所有的提交(即使是合并和冲突解决)压缩到一个功能分支上的一个,然后在我开始开发的分支之上重新建立基础从?不想重做已经完成的冲突解决.尽量减少麻烦.

How can I, with minimum effort, squash all my commits (even with merges and conflict resolutions) to a single one on a feature branch and then rebase on top of the branch where I started developing from? Don't want to redo conflict resolution that's already done. Keep hassle to a minimum.

假设我们说的分支是 master 和 featureX.

Suppose the branches we are talking about are master and featureX.

推荐答案

我所知道的最简单的方法是

The simplest way I know is

git checkout featureX
git merge -m "Bring latest changes from master" master
# magic starts here
git reset --soft master # put featureX branch pointer on top of master tip
# at this point all the changes related to featureX are on staging area
git commit -m "Feature X in a single shot"

你去吧.没有变基,没有挤压.

There you go. No rebasing, no squashing.

这篇关于如何一次挤压/变基的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆