git-20_It's NOT the last commit that has been rejected

This case is a little trickier, but far from impossible! The story here is that you've been doing quite a bit of work, and it's spread on a couple of different commits. The task is finished and the work has been pushed for review. Then the grumpy reviewer comes in and puts some remarks on the second commit out of four. The example below uses the myTaskToSolve branch, but it's only an example.
~/coremw > git checkout myTaskToSolve
~/coremw > git rebase --interactive HEAD~4
A editor window (for the interactive rebase) will pop up, looking something like the following:
pick 15f9f4e Makefiles for ntfSubscribe added.
pick 35c0506 Enable --with-rpm-release option in configure script. Enable basic make rpm
pick 52e60c0 Minor changes in mdf/cmwmdf files to get a further compilation
pick d317b92 Fix minor typos about libimmutil and liblogtrace

# Rebase 639edf4..d317b92 onto 639edf4
#
# Commands:
#  p, pick = use commit
#  r, reword = use commit, but edit the commit message
#  e, edit = use commit, but stop for amending
#  s, squash = use commit, but meld into previous commit
#  f, fixup = like "squash", but discard this commit's log message
#  x, exec = run command (the rest of the line) using shell
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out
~                                                  
The top-most commit is the last commit done in develop, the one that we want to change is 52e60c0 regarding changes in mdf, some comments where done on that particular change. Simply replace pick with edit in front of 52e60c0, then save the buffer and exit.

Now do the necessary rework so that the review might pass. Don't forget to do git add ChangeFile, and then finally git commit --amend (Don't change the Commit-Id). Once the commit is done, do git rebase --continue and finally git push-for-review.
~/coremw > vi ChangeFIle
~/coremw > git add ChangeFile
~/coremw > git commit --amend
~/coremw > git rebase --continue
~/coremw > git push-for-review
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值