<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><blockquote type="cite" class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div class="">  I do not get this. I thought that rebasing with main put all the main changes in before your commits. I have never seen any interspersed, so I do not understand this.</div></div></blockquote><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div class=""><br class=""></div><div class="">Mark, do you rebase your branch over main first or do you merge main intro your branch to update it? If you rebase, you can pick an N such that you only get your commits from the branch.</div><div class=""><br class=""></div></div></div><div class="">
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div>Best regards,<br class=""><br class="">Jacob Faibussowitsch<br class="">(Jacob Fai - booss - oh - vitch)<br class="">Cell: (312) 694-3391</div></div>

</div>
<div><br class=""><blockquote type="cite" class=""><div class="">On Mar 2, 2021, at 22:02, Barry Smith <<a href="mailto:bsmith@petsc.dev" class="">bsmith@petsc.dev</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Mar 2, 2021, at 9:24 PM, Mark Adams <<a href="mailto:mfadams@lbl.gov" class="">mfadams@lbl.gov</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Ah, 'git graph' I will try that next time.<div class=""><br class=""></div><div class="">I use 'git rebase -i HEAD~N', but you need an N. </div><div class=""><br class=""></div><div class="">After you 'git rebase origin/main' you get other commits interspersed in with yours,</div></div></div></blockquote><div class=""><br class=""></div>   I do not get this. I thought that rebasing with main put all the main changes in before your commits. I have never seen any interspersed, so I do not understand this.</div><div class=""><br class=""></div><div class="">  Barry</div><div class=""><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""> so I try to rebase -i before rebasing over main. Then rebase over main and you have a clean and updated branch. </div><div class=""><br class=""></div><div class="">Pick N to be large enough to cover the commits that you want to clean up. Don't touch the ones that are not yours from main, the last time you rebased over main.</div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 2, 2021 at 10:02 PM Junchao Zhang <<a href="mailto:junchao.zhang@gmail.com" class="">junchao.zhang@gmail.com</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class="">I am a naive git user, so I use interactive git rebase.  Suppose I am on the branch I want to modify, <div class=""><br class=""></div><div class="">1) Use git graph to locate an upstream commit to be used as the base</div><div class=""><span style="font-family:monospace" class="">$ git graph</span><br class=""></div><div class=""><font face="monospace" class="">* 0d5433e9 (HEAD -> jczhang/sf-change-api) SF: rename SFCreateEmbeddedSF to SFCreateEmbeddedRootSF<br class="">* e7314fbb SF: add an MPI_Op argument to SFBcast<br class="">* 83df288d Replace MPIU_REPLACE with MPI_REPLACE<br class="">*   b434c516 Merge branch 'barry/2021-02-02/petscsf-communication-specific' into 'main'<br class="">|\<br class="">| * 62152ded (barry/2021-02-02/petscsf-communication-specific) PetscSFView() never called viewer for the specific type (bug), hence many output files were incorrect.<br class="">* |   a4f5d9b4 Merge branch 'jose/upgrade-magma' into 'main'<br class=""></font></div><div class=""><br class=""></div><div class="">2) Suppose we choose b434c516 as the base. All commits we want to squash are after it.  Do interactive git rebase. It shows a screen for you to edit.  Read the help, which is helpful for new users</div><div class=""><span style="font-family:monospace" class="">  $ git rebase -i b434c516</span><br class=""></div><div class=""><font face="monospace" class="">pick 83df288d Replace MPIU_REPLACE with MPI_REPLACE<br class="">pick e7314fbb SF: add an MPI_Op argument to SFBcast<br class="">pick 0d5433e9 SF: rename SFCreateEmbeddedSF to SFCreateEmbeddedRootSF<br class=""><br class=""># Rebase b434c516..0d5433e9 onto b434c516 (3 commands)<br class="">#<br class=""># Commands:<br class=""># p, pick <commit> = use commit<br class=""># r, reword <commit> = use commit, but edit the commit message<br class=""># e, edit <commit> = use commit, but stop for amending<br class=""># s, squash <commit> = use commit, but meld into previous commit<br class=""># f, fixup <commit> = like "squash", but discard this commit's log message<br class=""># x, exec <command> = run command (the rest of the line) using shell<br class=""># b, break = stop here (continue rebase later with 'git rebase --continue')<br class=""># d, drop <commit> = remove commit<br class=""># l, label <label> = label current HEAD with a name<br class=""># t, reset <label> = reset HEAD to a label<br class=""># m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]<br class=""># .       create a merge commit using the original merge commit's<br class=""># .       message (or the oneline, if no original merge commit was<br class=""># .       specified). Use -c <commit> to reword the commit message.<br class="">#<br class=""># These lines can be re-ordered; they are executed from top to bottom.<br class="">#<br class=""># If you remove a line here THAT COMMIT WILL BE LOST.<br class="">#<br class=""># However, if you remove everything, the rebase will be aborted.<br class="">#<br class=""># Note that empty commits are commented out</font><br class=""></div><div class=""><br class=""></div><div class="">3) Suppose we want to squash the last two commits to 83df288d, replace their pick with s (or f, see the help for difference), save and exit the screen</div><div class="">pick 83df288d Replace MPIU_REPLACE with MPI_REPLACE<br class=""><font color="#ff0000" class="">s </font>e7314fbb SF: add an MPI_Op argument to SFBcast<br class=""><font color="#ff0000" class="">s</font> 0d5433e9 SF: rename SFCreateEmbeddedSF to SFCreateEmbeddedRootSF<br class=""></div><div class=""><br class=""></div><div class="">A new screen shows up</div><div class=""><br class=""></div><div class=""><font face="monospace" class=""># This is a combination of 3 commits.<br class=""># This is the 1st commit message:<br class=""><br class="">Replace MPIU_REPLACE with MPI_REPLACE<br class=""><br class="">Since we believe all MPI implementations support MPI_REPLACE<br class=""><br class=""># This is the commit message #2:<br class=""><br class="">SF: add an MPI_Op argument to SFBcast<br class=""><br class=""># This is the commit message #3:<br class=""><br class="">SF: rename SFCreateEmbeddedSF to SFCreateEmbeddedRootSF<br class=""><br class=""># Please enter the commit message for your changes. Lines starting<br class=""># with '#' will be ignored, and an empty message aborts the commit.</font></div><div class=""><br class=""></div><div class="">4) Edit the commit message as you want, save and exit, done!</div><div class=""><div class=""><div dir="ltr" class=""><div dir="ltr" class=""><br class=""></div><div dir="ltr" class="">--Junchao Zhang</div></div></div><br class=""></div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 2, 2021 at 6:19 PM Blaise A Bourdin <<a href="mailto:bourdin@lsu.edu" target="_blank" class="">bourdin@lsu.edu</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br class="">
<br class="">
This is not technically a petsc question. <br class="">
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.<br class="">
<br class="">
Anybody wants to pitch in, or explain me how to do this?<br class="">
<br class="">
Regards,<br class="">
Blaise<br class="">
<br class="">
-- <br class="">
A.K. & Shirley Barton Professor of  Mathematics<br class="">
Adjunct Professor of Mechanical Engineering<br class="">
Adjunct of the Center for Computation & Technology<br class="">
Louisiana State University, Lockett Hall Room 344, Baton Rouge, LA 70803, USA<br class="">
Tel. +1 (225) 578 1612, Fax  +1 (225) 578 4276 Web <a href="http://www.math.lsu.edu/~bourdin" rel="noreferrer" target="_blank" class="">http://www.math.lsu.edu/~bourdin</a><br class="">
<br class="">
</blockquote></div>
</blockquote></div>
</div></blockquote></div><br class=""></div></div></blockquote></div><br class=""></body></html>