[petsc-dev] Commit squashing in MR

Scott Kruger kruger at txcorp.com
Wed Mar 3 10:39:09 CST 2021


Attached is a little presentation that I gave to some fellow devs at
Tech-X.  It's a rehash of what has been discussed here, but the
graphical nature might be useful.

Scott


On 2021-03-02 21:32, Jed Brown did write:
> Satish Balay via petsc-dev <petsc-dev at mcs.anl.gov> writes:
> 
> > On Wed, 3 Mar 2021, Blaise A Bourdin wrote:
> >
> >> Hi,
> >> 
> >> This is not technically a petsc question. 
> >> It would be great to have a short section in the PETSc integration workflow document explaining how to squash commits in a MR for git-impaired developers like me.
> >> 
> >> Anybody wants to pitch in, or explain me how to do this?
> >
> > To squash commits - I use the 'squash' action in 'git rebase -i HASH' and figure out the HASH to use from 'gitk main..branch'
> >
> > [as git rebase requires the commit prior to the first commit of interest]
> >
> > git provides many ways of modifying the branch (and the rebase topic is very generic) so I think its best to rely on proper git docs/tutorials
> > [and its not really specific to petsc workflow]
> 
> You can do it in one line, without changing the base:
> 
>   git rebase -i $(git merge-base main HEAD)
> 
> 
> An alternative is
> 
>   git rebase -i main
> 
> which gives you interactive rebase to replay on top of current 'main'. This does two things at once and changing the base for your branch is not always desirable.

-- 
Scott Kruger
Tech-X Corporation               kruger at txcorp.com
5621 Arapahoe Ave, Suite A       Phone: (720) 466-3196
Boulder, CO 80303                Fax:   (303) 448-7756
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gitWorkflowNotes.pdf
Type: application/octet-stream
Size: 456065 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20210303/df9d38cc/attachment-0001.obj>


More information about the petsc-dev mailing list