git rebase重新开始功能开始



我想执行拉动请求,但发现主人比功能分支领先。

所以我做

git checkout master
git pull
git git checkout feature
git rebase origin/master

和boom,我收到冲突消息(预期(,但是rebase也会覆盖我在功能分支中所做的每一个更改,并用功能分支中的几个月代码覆盖它们...(rebase随附的代码不在从功能分支的开始。

的任何提交消息。

rebase还将删除我的所有新课程,这可能与主人不可能发生冲突。本地和远程主体和功能都进行了解码,并显示了预期的代码。但是,一旦我恢复。

所以rebase希望我做所有82次提交和冲突,而不是最新的提交?

我只想应用我的最新代码,然后用pr提交主人。我不希望几个月前其他人启动此功能而忘记重新构想的无用代码..

这是可能的吗?

结帐您的功能分支,然后从master拉入feature分支。如果有的话,请解决任何冲突,然后将其合并到master。这样,您将不会失去feature branch的任何提议。

git checkout feature-branch
git pull origin master
#resolve any conflicts if you get
git commit
git push
#pull request should be updated with your master branch contents now

您的意思是这样吗?我想把我的功能分支重新置于主人上,然后您可以做这个技巧来合并/南瓜(不实际壁板(:

git checkout my-branch
git merge origin/master # mix my code with master... don't worry about the merge or the history, we will turn it into a single revision on our next step
git reset --soft origin/master # here's the magic... all the history is gone, all we have now is your differences from origin/master on index and the branch is pointing to origin/master
git commit -m "My feature, in a single revision"

你去

最新更新