0

i have 5 commits pushed to gerrit for review. say 1, 2, 3, 4, 5.

Reviewer abandoned my 2nd commit and accepted 1, 3, 4, 5.

now, 3, 4 and 5 are not able to push due to abandoned change.

can someone please let me know on how to push 3,4,5 changes into branch.

all 5 commits are on the same branch.

Srikanth
  • 15
  • 3

1 Answers1

0

In your local repository, with the COMMIT-5 checkouted, execute the following command:

git rebase -i COMMIT-1

An editor will open with something like this:

pick COMMIT-2 COMMIT-2-MSG
pick COMMIT-3 COMMIT-3-MSG
pick COMMIT-4 COMMIT-4-MSG
pick COMMIT-5 COMMIT-5-MSG

# Rebase xxxxx..xxxxx onto xxxxx
#
# 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
# d, drop = remove commit

Change "pick" to "drop" in COMMIT-2 line, save, close the editor and the commit-2 will be removed from the history (run "git log" to confirm). Push to Gerrit.

Note: To avoid this situation, never send several commits in a row to Gerrit. Always work your commits parallely (more info here).