简体   繁体   English

更改上游推送的提交

[英]Change upstream pushed commit

I have two commits and both push upstream in master commit new and commit old. 我有两个提交,并且在主提交新提交和旧提交中都向上游推送。 Both of them should become PRs. 他们两个都应该成为PR。 Commit old should do base enhancements and commit two adds a feature. commit old应该做一些基本的增强,而commit两个要增加一个功能。 Now I need to add a fix to commit old. 现在,我需要添加一个修复以提交旧版本。

what I did: 我做了什么:

$ git rebase -i <commit_before_old>

applied the fixes 应用了修复程序

$ git commit --all --amend --no-edit
$ git rebase --continue
$ git push -u orign master -f

But this doesn't change the commit_old 但这不会改变commit_old

git reset --hard commit_old

apply fixes 应用修复

git commit --all --amend --no-edit
git cherry-pick commit_new

resolve conflicts if needed and commit 解决冲突(如果需要)并提交

git push -u orign master -f

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM