Hi,

vichy wrote:
> I have some questions.
> in below commit, http://openocd.zylin.com/#/c/2299/ , I found there is
> some format error and create patch B to fix it.
> Should I merge (A+B)=C, then commit C to gerrit again?

Yes, the term is to "amend" your original commit.

After doing this, you will in your local branch have replaced your
original commit A with the commit C which includes A+B.

When doing this, it is important that the new commit C has the same
parent commit as the original commit A, and it is important to
preserve the Change-Id: line from the commit message of A in the
commit message of C.

If you have already committed B locally, one way to create the
required commit C and push it to gerrit is:

export B=commit_hash_of_B_commit
git checkout -b format_error_fix 062650023f7db980974877d38eab12c09d4e80d0 && \
  git cherry-pick -n $B && \
  git commit --amend && \
  git push review


The above is a somewhat inconvenient, but simple, method.

If you have a local branch with A followed by B and with no other
commits then you can easily use the much more convenient interactive
rebase feature. Interactive rebase is the number one distinguishing
feature of git, it is very powerful because it can rework a large
history of commits, but it is important to use it carefully to not
have undesired results.

If you have a local branch with A followed by B and no other commits, run:

git rebase -i 062650023f7db980974877d38eab12c09d4e80d0^

Your text editor will open with two lines "pick 0626500.." and "pick B"
This type of file is called a rebase script, and tells git what it
should do in this interactive rebase. If the rebase script does not
have those two lines, DO NOT save and exit immediately, but first
*delete all lines* in the script and save an empty file. Only then
exit the editor. This is the only way to abort the interactive rebase
and to avoid making undesired changes in the current local branch.

If the rebase script does contain the correct two lines then
change the line "pick B" to "fixup B" and then save and exit the editor.

That's it - the rebase script told git that B is a fixup of A, so the
commit message should be kept, but the changes from B should be added,
and the A commit has been replaced on the local branch with C.

Now run:
git push review


//Peter

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to