How to replace Changes after the Gerrit review without changing the commit id?
One of the main benefits of code review is the ability to receive and incorporate feedback from other developers without changing the commit-id and review id. With Gerrit, you incorporate these changes by amending the commit. Gerrit uses the CHange-Id to ensure that each iteration of the commit are stored together as patchsets.
The process of modify same commit and commit message on gerrit after patchset creation is pretty straight forward.
Step 1 – Do the required modification in the code based on the review.
Step 2 – Add files using git add commands.
[code]$ git add filename[/code]
Step 3 – Command to update/amend the most recent commit.
[code]$ git commit –amend[/code]
When amending a commit with git commit –amend, leave the Change-Id line unmodified in the commit message. This will allow Gerrit to automatically update the change with the amended commit.
Step 4 – Gerrit updates the commit under review with your latest changes.
[code]$ git push origin HEAD:refs/for/master
$ git push origin HEAD:refs/for/[BRANCH_NAME][/code]
I’m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I am working at Cotocus. I blog tech insights at DevOps School, travel stories at Holiday Landmark, stock market tips at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at I reviewed , and SEO strategies at Wizbrand.
Please find my social handles as below;
Rajesh Kumar Personal Website
Rajesh Kumar at YOUTUBE
Rajesh Kumar at INSTAGRAM
Rajesh Kumar at X
Rajesh Kumar at FACEBOOK
Rajesh Kumar at LINKEDIN
Rajesh Kumar at PINTEREST
Rajesh Kumar at QUORA
Rajesh Kumar at WIZBRAND