Help with new GCC git workflow...

Richard Biener
Wed Jan 15 09:56:00 GMT 2020

On Tue, Jan 14, 2020 at 5:51 PM Eric S. Raymond <> wrote:
> Peter Bergner <>:
> > At this point, I get a little confused. :-)  I know to submit my patch
> > for review, I'll want to squash my commits down into one patch, but how
> > does one do that?  Should I do that now or only when I'm ready to
> > push this change to the upstream repo or ???  Do I need to even do that?
> If you want to squash a commit series, the magic is git rebase -i. You
> give that a number of commits to look back at at and you'll get a buffer
> instructing you how to squash and shuffle that series.  You'll also be able
> to edit the commit message.
> I like to write really fine-grained commits when I'm developing, then
> squash before pushing so the public repo commits always go from "tests
> pass" to "test pass".  That way you can do clean bisections on the
> public history.

The question is wheter one could achieve this with branches?  That is,
have master contain a merge commit from a branch that contains the
fine-grained commits?  Because for forensics those can be sometimes

That basically would somehow record that a series of commits are "related"
(the merge commit has two parents).  Of course usually the merge commit
is empty and thus non-existant but then for branch merges it still
always exists?

> > Also, when I'm ready to push this "change" upstream to trunk, I'll need
> > to move this over to my master and then push.  What are the recommended
> > commands for doing that?
> There are a couple of ways.  I usually squash as described above
> then use "git cherry-pick".  But that's because I have philosophical
> reasons to avoid long-lives branches.
> >                   I assume I need to rebase my branch to
> > current upstream master, since that probably has moved forward since
> > I checked my code out.
> Yes, in general you'll want to do that.
> > Also, at what point do I write my final commit message, which is different
> > than the (possibly simple) commit messages above?  Is that done after I've
> > pulled my local branch into my master?  ...or before?  ...or during the
> > merge over?
> I do it at rebase -i time along with the squash of the series.
> --
>                 <a href="">Eric S. Raymond</a>

More information about the Gcc mailing list