Check: Need to remove the Change-Id when moving from sandbox to master

Description

The developer's workflow of AGL includes a very convenient facility to put put developments in sandboxes.

Sandboxes can be used for trying, testing, forking, showing ideas, exchanging with others, ...

And sometime, when the development in the sandbox is achieved, the developer wants to push it in the master trunk. When the developer pushes it's sandbox branch in review he gets the message:

This is because the commit's messages have tags "Change-Id: XXXXXX..." already existing.

Environment

None

Activity

jose bollo 
March 21, 2019 at 3:09 PM

The solution is to change the values of the Change-Id tags. This change is done automatically by the commit hook if the tag Change-Id is missing. So the idea is to remove the existing *Change-Id*s of the commits to send in review for master trunk.

The way to do it mostly depends on the count of commits that have to be processed or of the available goody tools you forged to easy your life:

  1. you have only 1 commit: use the solution AMEND

  2. you few commits: use the solution REBASE

  3. you have a pile of commits: use the solution SCRIPT

  4. you are lazy: use the solution SCRIPT

For all the described solution below, it is assumed that the current HEAD is the last commit to be applied from the group of commits that you want to submit in review.

  • solution AMEND:

Issue the command git commit --amend and remove from the commit message the line that starts with Change-Id:.

This create a fresh commit with a new Change-Id that can be submitted in review.

  • solution REBASE:

Issue the command git rebase -i BOTTOM where BOTTOM is the parent commit of the first commit to be applied from the group of commits that you want to submit in review. You can use SHA or name for BOTTOM but note that BOTTOM is very likely to be origin/master.

It opens the usual interactive rebase description file. Replace in the list of commits the picking tag pick by the reword tag. With vi it can be done with the command s/^pick /reword /.

Then, for each commit message that git opens in your prefered editor, and remove the line that starts with Change-Id:.

After that, your on the top of fresh commits with a new Change-Id that can be submitted in review.

  • solution SCRIPT:

The following script can be used to automatically remove the change ids from your set of commits to submit.

This script can be used exactly like git rebase.

If the name of the script is change-commit-ids just type the command *change-commit-ids BOTTOM where BOTTOM, like for solution REBASE, is the parent commit of the first commit to be applied from the group of commits that you want to submit in review. You can use SHA or name for BOTTOM but note that BOTTOM is very likely to be origin/master.

Fixed

Details

Assignee

Reporter

Labels

Contract ID

Priority

Created April 12, 2018 at 8:29 AM
Updated June 25, 2019 at 3:50 PM
Resolved June 20, 2019 at 8:53 AM