{"id":5224,"date":"2018-08-22T12:17:20","date_gmt":"2018-08-22T12:17:20","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/?p=5224"},"modified":"2018-09-05T08:57:12","modified_gmt":"2018-09-05T08:57:12","slug":"how-to-replace-changes-after-the-gerrit-review-without-changing-the-commit-id","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/how-to-replace-changes-after-the-gerrit-review-without-changing-the-commit-id\/","title":{"rendered":"How to replace Changes after the Gerrit review without changing the commit id?"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5291\" src=\"http:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2018\/08\/gerrit-5.png\" alt=\"\" width=\"600\" height=\"350\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2018\/08\/gerrit-5.png 600w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2018\/08\/gerrit-5-300x175.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p><strong>How to replace Changes after the Gerrit review without changing the commit id?<\/strong><\/p>\n<p>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.<\/p>\n<p>The process of modify same commit and commit message on gerrit after patchset creation is pretty straight forward.<\/p>\n<p><strong>Step 1 &#8211; Do the required modification in the code based on the review.<\/strong><\/p>\n<p><strong>Step 2 &#8211; Add files using git add commands.<\/strong><\/p>\n<p>[code]$ git add filename[\/code]<\/p>\n<p><strong>Step 3 &#8211; Command to update\/amend the most recent commit.<\/strong><\/p>\n<p>[code]$ git commit &#8211;amend[\/code]<\/p>\n<p>When amending a commit with git commit &#8211;amend, leave the Change-Id line unmodified in the commit message. This will allow Gerrit to automatically update the change with the amended commit.<\/p>\n<p><strong>Step 4 &#8211; Gerrit updates the commit under review with your latest changes.<\/strong><\/p>\n<p>[code]$ git push origin HEAD:refs\/for\/master<br \/>\n$ git push origin HEAD:refs\/for\/[BRANCH_NAME][\/code]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#8230; <\/p>\n","protected":false},"author":1,"featured_media":5291,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[4994],"tags":[5024,1964,5023,945,5025,5020,5019,5026],"class_list":["post-5224","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-gerrit","tag-amend","tag-changes","tag-commit","tag-gerrit","tag-git-add","tag-git-commit","tag-git-push","tag-patchset"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/5224","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=5224"}],"version-history":[{"count":3,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/5224\/revisions"}],"predecessor-version":[{"id":5292,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/5224\/revisions\/5292"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media\/5291"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=5224"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=5224"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=5224"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}