I have a commit with two files changed (file a and b), I pushed it to gerrit repo (but not yet merged). Now I realize I dont need to update b. How do I push a new changeset that removes/un-commits b and only includes file a?
In your your local repository do the following:
Remove file-b from the commit
git reset HEAD^ -- file-b
Amend the commit without the file-b
git commit --amend
Discard file-b changes
git checkout -- file-b
Confirm that everything is OK
git status
git log
git diff HEAD^ HEAD
Push the new commit to Gerrit (new patchset)
git push origin HEAD:refs/for/master
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With