Update Gerrit Change xCode


Often times you will need to update the commit after it is already pushed. For example you may need to change something based on a comment in Gerrit.

It is important that you update the commit and do not submit a brand new change. This will keep the comment and patch history in place.

Save existing work in xCode

Save your current xCode work by commiting it Note: you do not need to push to origin

Checkout Previous Commit

Get Checkout Command from Gerrit

Go to the change in Gerrit Expand the patch set you want to edit In the download section click checkout and ssh Copy the command given, it should be something like:

git fetch ssh://user@server/projectname refs/changes/00/700/1 && git checkout FETCH_HEAD

Checkout commit from command line

Navigate to the project folder Run the command gathered in last step

git fetch ssh://user@server/projectname refs/changes/00/700/1 && git checkout FETCH_HEAD

Make Changes in xCode

Do what you do.

Push Changes to Gerrit

Add files to commit

Navigate to project folder in terminal Add files to commit with git add .

Amend commit

git commit —amend —no-edit

Push commit to Gerrit for review

git push origin HEAD:refs/for/master

Now your Gerrit change will have a new patch set and all history will be preserved



Originally published at www.parsed.io.

Show your support

Clapping shows how much you appreciated Casey Garland’s story.