Re: [petsc-dev] Commit squashing in MR

2021-03-04 Thread Jed Brown
If you're in Emacs, Magit (https://github.com/magit/magit) is excellent for 
much the same things, and works over remote (i.e., I'm editing 
"ssh:thathost:path/to/file.c" and invoke magit).

There's also a (partial) magit clone for vscode.

https://marketplace.visualstudio.com/items?itemName=kahole.magit

Patrick Sanan  writes:

> I have also been enjoying using lazygit (thanks, Lisandro, for the tip!).  
> It's a similar sort of thing but runs in the terminal.
>  I find it very useful for those things where the command line git tool falls 
> down (staging parts of files, browsing large sets of changes), and I like 
> that I don't have to bother with X windows to use something like gitk on my 
> remote machine.
>
> https://github.com/jesseduffield/lazygit
>
> The only wrinkles I ran into using this are that is seems to assume you have 
> a somewhat-recent "git" executable for some of the fancier
> features (like merging or rearranging commits without using git rebase -i).
>
>> Am 03.03.2021 um 21:02 schrieb Jacob Faibussowitsch :
>> 
>>> 'gitk' is easier to read [for me] than 'git log --graph'
>> 
>> Where was this my entire life… best kept git secret!
>> 
>> Best regards,
>> 
>> Jacob Faibussowitsch
>> (Jacob Fai - booss - oh - vitch)
>> Cell: (312) 694-3391
>> 
>>> On Mar 3, 2021, at 13:55, Satish Balay >> > wrote:
>>> 
>>> 'gitk' is easier to read [for me] than 'git log --graph'
>>> 
>>> Satish
>>> 
>>> On Wed, 3 Mar 2021, Jacob Faibussowitsch wrote:
>>> 
> git: 'graph' is not a git command. See 'git --help'.
 
 I have it as an alias:
 
 graph = !git log --graph --pretty=format:'%Cred%h%Creset 
 -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' 
 --abbrev-commit --date=relative
 
 Best regards,
 
 Jacob Faibussowitsch
 (Jacob Fai - booss - oh - vitch)
 Cell: (312) 694-3391
 
> On Mar 3, 2021, at 13:50, Mark Adams  > wrote:
> 
> 
> 
> On Tue, Mar 2, 2021 at 10:02 PM Junchao Zhang    >> wrote:
> I am a naive git user, so I use interactive git rebase.  Suppose I am on 
> the branch I want to modify, 
> 
> 1) Use git graph to locate an upstream commit to be used as the base
> $ git graph
> 
> Humm 
> 
> 14:49 adams/cusparse-lu-landau= /gpfs/alpine/csc314/scratch/adams/petsc$ 
> git --version
> git version 2.20.1
> 14:49 adams/cusparse-lu-landau= /gpfs/alpine/csc314/scratch/adams/petsc$ 
> git graph
> git: 'graph' is not a git command. See 'git --help'.
> 
> The most similar commands are
> branch
> grep
> 
 
 
>>> 
>> 


Re: [petsc-dev] Commit squashing in MR

2021-03-04 Thread Patrick Sanan
I have also been enjoying using lazygit (thanks, Lisandro, for the tip!).  It's 
a similar sort of thing but runs in the terminal.
 I find it very useful for those things where the command line git tool falls 
down (staging parts of files, browsing large sets of changes), and I like that 
I don't have to bother with X windows to use something like gitk on my remote 
machine.

https://github.com/jesseduffield/lazygit

The only wrinkles I ran into using this are that is seems to assume you have a 
somewhat-recent "git" executable for some of the fancier
features (like merging or rearranging commits without using git rebase -i).

> Am 03.03.2021 um 21:02 schrieb Jacob Faibussowitsch :
> 
>> 'gitk' is easier to read [for me] than 'git log --graph'
> 
> Where was this my entire life… best kept git secret!
> 
> Best regards,
> 
> Jacob Faibussowitsch
> (Jacob Fai - booss - oh - vitch)
> Cell: (312) 694-3391
> 
>> On Mar 3, 2021, at 13:55, Satish Balay > > wrote:
>> 
>> 'gitk' is easier to read [for me] than 'git log --graph'
>> 
>> Satish
>> 
>> On Wed, 3 Mar 2021, Jacob Faibussowitsch wrote:
>> 
 git: 'graph' is not a git command. See 'git --help'.
>>> 
>>> I have it as an alias:
>>> 
>>> graph = !git log --graph --pretty=format:'%Cred%h%Creset 
>>> -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' 
>>> --abbrev-commit --date=relative
>>> 
>>> Best regards,
>>> 
>>> Jacob Faibussowitsch
>>> (Jacob Fai - booss - oh - vitch)
>>> Cell: (312) 694-3391
>>> 
 On Mar 3, 2021, at 13:50, Mark Adams >>> > wrote:
 
 
 
 On Tue, Mar 2, 2021 at 10:02 PM Junchao Zhang >>>  >> wrote:
 I am a naive git user, so I use interactive git rebase.  Suppose I am on 
 the branch I want to modify, 
 
 1) Use git graph to locate an upstream commit to be used as the base
 $ git graph
 
 Humm 
 
 14:49 adams/cusparse-lu-landau= /gpfs/alpine/csc314/scratch/adams/petsc$ 
 git --version
 git version 2.20.1
 14:49 adams/cusparse-lu-landau= /gpfs/alpine/csc314/scratch/adams/petsc$ 
 git graph
 git: 'graph' is not a git command. See 'git --help'.
 
 The most similar commands are
 branch
 grep
 
>>> 
>>> 
>> 
> 



Re: [petsc-dev] Commit squashing in MR

2021-03-03 Thread Jacob Faibussowitsch
This is certainly useful, prior to this I was using 

git diff $(git merge-base --fork-point main)

To see branch changes (but this would dump all changes in all files in 
terminal, so quite unwieldy for large diffs)...

Best regards,

Jacob Faibussowitsch
(Jacob Fai - booss - oh - vitch)
Cell: (312) 694-3391

> On Mar 3, 2021, at 14:12, Satish Balay  wrote:
> 
> Also: sometimes I don't want to see the individual commits - just the overall 
> change in this branch [aka the MR 'changes' view]
> 
> git diff main...origin/jacobf/2020-09-09/feature/petscmapping/future
> 
> Only diff for include/petsc.h
> 
> git diff main...origin/jacobf/2020-09-09/feature/petscmapping/future 
> include/petsc.h
> 
> Satish
> 
> 
> On Wed, 3 Mar 2021, Satish Balay via petsc-dev wrote:
> 
>> And I frequently use it - for ex, to check (only) the commits in a branch - 
>> say origin/jacobf/2020-09-09/feature/petscmapping/future
>> 
>> gitk main..origin/jacobf/2020-09-09/feature/petscmapping/future
>> 
>> [equivalent to "git log 
>> main..origin/jacobf/2020-09-09/feature/petscmapping/future"]
>> 
>> And then check the diffs for individual commit (as needed) via this interface
>> 
>> Check only the diffs for changes to include/petsc.h in this branch
>> 
>> gitk main..origin/jacobf/2020-09-09/feature/petscmapping/future 
>> include/petsc.h
>> 
>> Satish
>> 
>> On Wed, 3 Mar 2021, Jacob Faibussowitsch wrote:
>> 
 'gitk' is easier to read [for me] than 'git log --graph'
>>> 
>>> Where was this my entire life… best kept git secret!
>>> 
>>> Best regards,
>>> 
>>> Jacob Faibussowitsch
>>> (Jacob Fai - booss - oh - vitch)
>>> Cell: (312) 694-3391
>>> 
 On Mar 3, 2021, at 13:55, Satish Balay  wrote:
 
 'gitk' is easier to read [for me] than 'git log --graph'
 
 Satish
 
 On Wed, 3 Mar 2021, Jacob Faibussowitsch wrote:
 
>> git: 'graph' is not a git command. See 'git --help'.
> 
> I have it as an alias:
> 
> graph = !git log --graph --pretty=format:'%Cred%h%Creset 
> -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' 
> --abbrev-commit --date=relative
> 
> Best regards,
> 
> Jacob Faibussowitsch
> (Jacob Fai - booss - oh - vitch)
> Cell: (312) 694-3391
> 
>> On Mar 3, 2021, at 13:50, Mark Adams  wrote:
>> 
>> 
>> 
>> On Tue, Mar 2, 2021 at 10:02 PM Junchao Zhang > > wrote:
>> I am a naive git user, so I use interactive git rebase.  Suppose I am on 
>> the branch I want to modify, 
>> 
>> 1) Use git graph to locate an upstream commit to be used as the base
>> $ git graph
>> 
>> Humm 
>> 
>> 14:49 adams/cusparse-lu-landau= /gpfs/alpine/csc314/scratch/adams/petsc$ 
>> git --version
>> git version 2.20.1
>> 14:49 adams/cusparse-lu-landau= /gpfs/alpine/csc314/scratch/adams/petsc$ 
>> git graph
>> git: 'graph' is not a git command. See 'git --help'.
>> 
>> The most similar commands are
>> branch
>> grep
>> 
> 
> 
 
>>> 
>>> 
>> 



Re: [petsc-dev] Commit squashing in MR

2021-03-03 Thread Satish Balay via petsc-dev
Also: sometimes I don't want to see the individual commits - just the overall 
change in this branch [aka the MR 'changes' view]

git diff main...origin/jacobf/2020-09-09/feature/petscmapping/future

Only diff for include/petsc.h

git diff main...origin/jacobf/2020-09-09/feature/petscmapping/future 
include/petsc.h

Satish


On Wed, 3 Mar 2021, Satish Balay via petsc-dev wrote:

> And I frequently use it - for ex, to check (only) the commits in a branch - 
> say origin/jacobf/2020-09-09/feature/petscmapping/future
> 
> gitk main..origin/jacobf/2020-09-09/feature/petscmapping/future
> 
> [equivalent to "git log 
> main..origin/jacobf/2020-09-09/feature/petscmapping/future"]
> 
> And then check the diffs for individual commit (as needed) via this interface
> 
> Check only the diffs for changes to include/petsc.h in this branch
> 
> gitk main..origin/jacobf/2020-09-09/feature/petscmapping/future 
> include/petsc.h
> 
> Satish
> 
> On Wed, 3 Mar 2021, Jacob Faibussowitsch wrote:
> 
> > > 'gitk' is easier to read [for me] than 'git log --graph'
> > 
> > Where was this my entire life… best kept git secret!
> > 
> > Best regards,
> > 
> > Jacob Faibussowitsch
> > (Jacob Fai - booss - oh - vitch)
> > Cell: (312) 694-3391
> > 
> > > On Mar 3, 2021, at 13:55, Satish Balay  wrote:
> > > 
> > > 'gitk' is easier to read [for me] than 'git log --graph'
> > > 
> > > Satish
> > > 
> > > On Wed, 3 Mar 2021, Jacob Faibussowitsch wrote:
> > > 
> > >>> git: 'graph' is not a git command. See 'git --help'.
> > >> 
> > >> I have it as an alias:
> > >> 
> > >> graph = !git log --graph --pretty=format:'%Cred%h%Creset 
> > >> -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' 
> > >> --abbrev-commit --date=relative
> > >> 
> > >> Best regards,
> > >> 
> > >> Jacob Faibussowitsch
> > >> (Jacob Fai - booss - oh - vitch)
> > >> Cell: (312) 694-3391
> > >> 
> > >>> On Mar 3, 2021, at 13:50, Mark Adams  wrote:
> > >>> 
> > >>> 
> > >>> 
> > >>> On Tue, Mar 2, 2021 at 10:02 PM Junchao Zhang  > >>> > wrote:
> > >>> I am a naive git user, so I use interactive git rebase.  Suppose I am 
> > >>> on the branch I want to modify, 
> > >>> 
> > >>> 1) Use git graph to locate an upstream commit to be used as the base
> > >>> $ git graph
> > >>> 
> > >>> Humm 
> > >>> 
> > >>> 14:49 adams/cusparse-lu-landau= 
> > >>> /gpfs/alpine/csc314/scratch/adams/petsc$ git --version
> > >>> git version 2.20.1
> > >>> 14:49 adams/cusparse-lu-landau= 
> > >>> /gpfs/alpine/csc314/scratch/adams/petsc$ git graph
> > >>> git: 'graph' is not a git command. See 'git --help'.
> > >>> 
> > >>> The most similar commands are
> > >>> branch
> > >>> grep
> > >>> 
> > >> 
> > >> 
> > > 
> > 
> > 
> 


Re: [petsc-dev] Commit squashing in MR

2021-03-03 Thread Satish Balay via petsc-dev
And I frequently use it - for ex, to check (only) the commits in a branch - say 
origin/jacobf/2020-09-09/feature/petscmapping/future

gitk main..origin/jacobf/2020-09-09/feature/petscmapping/future

[equivalent to "git log 
main..origin/jacobf/2020-09-09/feature/petscmapping/future"]

And then check the diffs for individual commit (as needed) via this interface

Check only the diffs for changes to include/petsc.h in this branch

gitk main..origin/jacobf/2020-09-09/feature/petscmapping/future include/petsc.h

Satish

On Wed, 3 Mar 2021, Jacob Faibussowitsch wrote:

> > 'gitk' is easier to read [for me] than 'git log --graph'
> 
> Where was this my entire life… best kept git secret!
> 
> Best regards,
> 
> Jacob Faibussowitsch
> (Jacob Fai - booss - oh - vitch)
> Cell: (312) 694-3391
> 
> > On Mar 3, 2021, at 13:55, Satish Balay  wrote:
> > 
> > 'gitk' is easier to read [for me] than 'git log --graph'
> > 
> > Satish
> > 
> > On Wed, 3 Mar 2021, Jacob Faibussowitsch wrote:
> > 
> >>> git: 'graph' is not a git command. See 'git --help'.
> >> 
> >> I have it as an alias:
> >> 
> >> graph = !git log --graph --pretty=format:'%Cred%h%Creset 
> >> -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' 
> >> --abbrev-commit --date=relative
> >> 
> >> Best regards,
> >> 
> >> Jacob Faibussowitsch
> >> (Jacob Fai - booss - oh - vitch)
> >> Cell: (312) 694-3391
> >> 
> >>> On Mar 3, 2021, at 13:50, Mark Adams  wrote:
> >>> 
> >>> 
> >>> 
> >>> On Tue, Mar 2, 2021 at 10:02 PM Junchao Zhang  >>> > wrote:
> >>> I am a naive git user, so I use interactive git rebase.  Suppose I am on 
> >>> the branch I want to modify, 
> >>> 
> >>> 1) Use git graph to locate an upstream commit to be used as the base
> >>> $ git graph
> >>> 
> >>> Humm 
> >>> 
> >>> 14:49 adams/cusparse-lu-landau= /gpfs/alpine/csc314/scratch/adams/petsc$ 
> >>> git --version
> >>> git version 2.20.1
> >>> 14:49 adams/cusparse-lu-landau= /gpfs/alpine/csc314/scratch/adams/petsc$ 
> >>> git graph
> >>> git: 'graph' is not a git command. See 'git --help'.
> >>> 
> >>> The most similar commands are
> >>> branch
> >>> grep
> >>> 
> >> 
> >> 
> > 
> 
> 


Re: [petsc-dev] Commit squashing in MR

2021-03-03 Thread Jacob Faibussowitsch
> 'gitk' is easier to read [for me] than 'git log --graph'

Where was this my entire life… best kept git secret!

Best regards,

Jacob Faibussowitsch
(Jacob Fai - booss - oh - vitch)
Cell: (312) 694-3391

> On Mar 3, 2021, at 13:55, Satish Balay  wrote:
> 
> 'gitk' is easier to read [for me] than 'git log --graph'
> 
> Satish
> 
> On Wed, 3 Mar 2021, Jacob Faibussowitsch wrote:
> 
>>> git: 'graph' is not a git command. See 'git --help'.
>> 
>> I have it as an alias:
>> 
>> graph = !git log --graph --pretty=format:'%Cred%h%Creset 
>> -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' 
>> --abbrev-commit --date=relative
>> 
>> Best regards,
>> 
>> Jacob Faibussowitsch
>> (Jacob Fai - booss - oh - vitch)
>> Cell: (312) 694-3391
>> 
>>> On Mar 3, 2021, at 13:50, Mark Adams  wrote:
>>> 
>>> 
>>> 
>>> On Tue, Mar 2, 2021 at 10:02 PM Junchao Zhang >> > wrote:
>>> I am a naive git user, so I use interactive git rebase.  Suppose I am on 
>>> the branch I want to modify, 
>>> 
>>> 1) Use git graph to locate an upstream commit to be used as the base
>>> $ git graph
>>> 
>>> Humm 
>>> 
>>> 14:49 adams/cusparse-lu-landau= /gpfs/alpine/csc314/scratch/adams/petsc$ 
>>> git --version
>>> git version 2.20.1
>>> 14:49 adams/cusparse-lu-landau= /gpfs/alpine/csc314/scratch/adams/petsc$ 
>>> git graph
>>> git: 'graph' is not a git command. See 'git --help'.
>>> 
>>> The most similar commands are
>>> branch
>>> grep
>>> 
>> 
>> 
> 



Re: [petsc-dev] Commit squashing in MR

2021-03-03 Thread Mark Adams
On Wed, Mar 3, 2021 at 2:53 PM Jacob Faibussowitsch 
wrote:

> git: 'graph' is not a git command. See 'git --help'.
>
>
> I have it as an alias:
>
> graph = !git log --graph --pretty=format:'%Cred%h%Creset
> -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'
> --abbrev-commit --date=relative
>

Ah, I like that. I don't have gitk on all my machines.
Thanks,


>
> Best regards,
>
> Jacob Faibussowitsch
> (Jacob Fai - booss - oh - vitch)
> Cell: (312) 694-3391
>
> On Mar 3, 2021, at 13:50, Mark Adams  wrote:
>
>
>
> On Tue, Mar 2, 2021 at 10:02 PM Junchao Zhang 
> wrote:
>
>> I am a naive git user, so I use interactive git rebase.  Suppose I am on
>> the branch I want to modify,
>>
>> 1) Use git graph to locate an upstream commit to be used as the base
>> $ git graph
>>
>
> Humm 
>
> 14:49 adams/cusparse-lu-landau= /gpfs/alpine/csc314/scratch/adams/petsc$
> git --version
> git version 2.20.1
> 14:49 adams/cusparse-lu-landau= /gpfs/alpine/csc314/scratch/adams/petsc$
> git graph
> git: 'graph' is not a git command. See 'git --help'.
>
> The most similar commands are
> branch
> grep
>
>
>
>


Re: [petsc-dev] Commit squashing in MR

2021-03-03 Thread Junchao Zhang
Oh, graph is an alias in my .gitconfig

[alias]
graph = log --graph --decorate --abbrev-commit --pretty=oneline

--Junchao Zhang


On Wed, Mar 3, 2021 at 1:51 PM Mark Adams  wrote:

>
>
> On Tue, Mar 2, 2021 at 10:02 PM Junchao Zhang 
> wrote:
>
>> I am a naive git user, so I use interactive git rebase.  Suppose I am on
>> the branch I want to modify,
>>
>> 1) Use git graph to locate an upstream commit to be used as the base
>> $ git graph
>>
>
> Humm 
>
> 14:49 adams/cusparse-lu-landau= /gpfs/alpine/csc314/scratch/adams/petsc$
> git --version
> git version 2.20.1
> 14:49 adams/cusparse-lu-landau= /gpfs/alpine/csc314/scratch/adams/petsc$
> git graph
> git: 'graph' is not a git command. See 'git --help'.
>
> The most similar commands are
> branch
> grep
>
>


Re: [petsc-dev] Commit squashing in MR

2021-03-03 Thread Satish Balay via petsc-dev
'gitk' is easier to read [for me] than 'git log --graph'

Satish

On Wed, 3 Mar 2021, Jacob Faibussowitsch wrote:

> > git: 'graph' is not a git command. See 'git --help'.
> 
> I have it as an alias:
> 
> graph = !git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset 
> %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
> 
> Best regards,
> 
> Jacob Faibussowitsch
> (Jacob Fai - booss - oh - vitch)
> Cell: (312) 694-3391
> 
> > On Mar 3, 2021, at 13:50, Mark Adams  wrote:
> > 
> > 
> > 
> > On Tue, Mar 2, 2021 at 10:02 PM Junchao Zhang  > > wrote:
> > I am a naive git user, so I use interactive git rebase.  Suppose I am on 
> > the branch I want to modify, 
> > 
> > 1) Use git graph to locate an upstream commit to be used as the base
> > $ git graph
> > 
> > Humm 
> > 
> > 14:49 adams/cusparse-lu-landau= /gpfs/alpine/csc314/scratch/adams/petsc$ 
> > git --version
> > git version 2.20.1
> > 14:49 adams/cusparse-lu-landau= /gpfs/alpine/csc314/scratch/adams/petsc$ 
> > git graph
> > git: 'graph' is not a git command. See 'git --help'.
> > 
> > The most similar commands are
> > branch
> > grep
> >  
> 
> 



Re: [petsc-dev] Commit squashing in MR

2021-03-03 Thread Jacob Faibussowitsch
> git: 'graph' is not a git command. See 'git --help'.

I have it as an alias:

graph = !git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset 
%s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative

Best regards,

Jacob Faibussowitsch
(Jacob Fai - booss - oh - vitch)
Cell: (312) 694-3391

> On Mar 3, 2021, at 13:50, Mark Adams  wrote:
> 
> 
> 
> On Tue, Mar 2, 2021 at 10:02 PM Junchao Zhang  > wrote:
> I am a naive git user, so I use interactive git rebase.  Suppose I am on the 
> branch I want to modify, 
> 
> 1) Use git graph to locate an upstream commit to be used as the base
> $ git graph
> 
> Humm 
> 
> 14:49 adams/cusparse-lu-landau= /gpfs/alpine/csc314/scratch/adams/petsc$ git 
> --version
> git version 2.20.1
> 14:49 adams/cusparse-lu-landau= /gpfs/alpine/csc314/scratch/adams/petsc$ git 
> graph
> git: 'graph' is not a git command. See 'git --help'.
> 
> The most similar commands are
> branch
> grep
>  



Re: [petsc-dev] Commit squashing in MR

2021-03-03 Thread Satish Balay via petsc-dev
On Wed, 3 Mar 2021, Mark Adams wrote:

> On Tue, Mar 2, 2021 at 11:09 PM Jacob Faibussowitsch 
> wrote:
> 
> >   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.
> >
> >
> > Mark, do you rebase your branch over main first or do you merge main intro
> > your branch to update it?
> >
> 
> I never merge anymore. just rebase over main.
> 
> 
> > If you rebase, you can pick an N such that you only get your commits from
> > the branch.
> >
> 
> Yea, but what is N? If you know that then use it. I just guess if I lose
> track (I bounce between my Mac and two GPU machines so I can do a lot of
> wip commits) and as long as you guess too big, you will see where your
> commits start and ignore the rest.

If making simultaneous changes over multiple clones (to the same branch) - 'git 
pull --rebase' can be useful.

Satish

> 
> 
> >
> > Best regards,
> >
> > Jacob Faibussowitsch
> > (Jacob Fai - booss - oh - vitch)
> > Cell: (312) 694-3391
> >
> > On Mar 2, 2021, at 22:02, Barry Smith  wrote:
> >
> >
> >
> > On Mar 2, 2021, at 9:24 PM, Mark Adams  wrote:
> >
> > Ah, 'git graph' I will try that next time.
> >
> > I use 'git rebase -i HEAD~N', but you need an N.
> >
> > After you 'git rebase origin/main' you get other commits interspersed in
> > with yours,
> >
> >
> >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.
> >
> >   Barry
> >
> > so I try to rebase -i before rebasing over main. Then rebase over main and
> > you have a clean and updated branch.
> >
> > 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.
> >
> > On Tue, Mar 2, 2021 at 10:02 PM Junchao Zhang 
> > wrote:
> >
> >> I am a naive git user, so I use interactive git rebase.  Suppose I am on
> >> the branch I want to modify,
> >>
> >> 1) Use git graph to locate an upstream commit to be used as the base
> >> $ git graph
> >> * 0d5433e9 (HEAD -> jczhang/sf-change-api) SF: rename SFCreateEmbeddedSF
> >> to SFCreateEmbeddedRootSF
> >> * e7314fbb SF: add an MPI_Op argument to SFBcast
> >> * 83df288d Replace MPIU_REPLACE with MPI_REPLACE
> >> *   b434c516 Merge branch
> >> 'barry/2021-02-02/petscsf-communication-specific' into 'main'
> >> |\
> >> | * 62152ded (barry/2021-02-02/petscsf-communication-specific)
> >> PetscSFView() never called viewer for the specific type (bug), hence many
> >> output files were incorrect.
> >> * |   a4f5d9b4 Merge branch 'jose/upgrade-magma' into 'main'
> >>
> >> 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
> >>   $ git rebase -i b434c516
> >> pick 83df288d Replace MPIU_REPLACE with MPI_REPLACE
> >> pick e7314fbb SF: add an MPI_Op argument to SFBcast
> >> pick 0d5433e9 SF: rename SFCreateEmbeddedSF to SFCreateEmbeddedRootSF
> >>
> >> # Rebase b434c516..0d5433e9 onto b434c516 (3 commands)
> >> #
> >> # Commands:
> >> # p, pick  = use commit
> >> # r, reword  = use commit, but edit the commit message
> >> # e, edit  = use commit, but stop for amending
> >> # s, squash  = use commit, but meld into previous commit
> >> # f, fixup  = like "squash", but discard this commit's log message
> >> # x, exec  = run command (the rest of the line) using shell
> >> # b, break = stop here (continue rebase later with 'git rebase
> >> --continue')
> >> # d, drop  = remove commit
> >> # l, label  = label current HEAD with a name
> >> # t, reset  = reset HEAD to a label
> >> # m, merge [-C  | -c ]  [# ]
> >> # .   create a merge commit using the original merge commit's
> >> # .   message (or the oneline, if no original merge commit was
> >> # .   specified). Use -c  to reword the commit message.
> >> #
> >> # These lines can be re-ordered; they are executed from top to bottom.
> >> #
> >> # If you remove a line here THAT COMMIT WILL BE LOST.
> >> #
> >> # However, if you remove everything, the rebase will be aborted.
> >> #
> >> # Note that empty commits are commented out
> >>
> >> 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
> >> pick 83df288d Replace MPIU_REPLACE with MPI_REPLACE
> >> s e7314fbb SF: add an MPI_Op argument to SFBcast
> >> s 0d5433e9 SF: rename SFCreateEmbeddedSF to SFCreateEmbeddedRootSF
> >>
> >> A new screen shows up
> >>
> >> # This is a combination of 3 commits.
> >> # This is the 1st commit message:
> >>
> >> Replace MPIU_REPLACE with MPI_REPLACE
> >>
> >> Since we believe all MPI implementations support MPI_REPLACE
> >>
> >> # This is the commit message #2:
> >>
> >> SF: add 

Re: [petsc-dev] Commit squashing in MR

2021-03-03 Thread Mark Adams
On Tue, Mar 2, 2021 at 10:02 PM Junchao Zhang 
wrote:

> I am a naive git user, so I use interactive git rebase.  Suppose I am on
> the branch I want to modify,
>
> 1) Use git graph to locate an upstream commit to be used as the base
> $ git graph
>

Humm 

14:49 adams/cusparse-lu-landau= /gpfs/alpine/csc314/scratch/adams/petsc$
git --version
git version 2.20.1
14:49 adams/cusparse-lu-landau= /gpfs/alpine/csc314/scratch/adams/petsc$
git graph
git: 'graph' is not a git command. See 'git --help'.

The most similar commands are
branch
grep


Re: [petsc-dev] Commit squashing in MR

2021-03-03 Thread Satish Balay via petsc-dev
On Wed, 3 Mar 2021, Mark Adams wrote:

> On Tue, Mar 2, 2021 at 11:02 PM Barry Smith  wrote:
> 
> >
> >
> > On Mar 2, 2021, at 9:24 PM, Mark Adams  wrote:
> >
> > Ah, 'git graph' I will try that next time.
> >
> > I use 'git rebase -i HEAD~N', but you need an N.
> >
> > After you 'git rebase origin/main' you get other commits interspersed in
> > with yours,
> >
> >
> >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.
> >
> 
> Humm, I'm not sure. The important thing is that you will hit main commits
> and you don't want to touch those or the first of your commits.

Best to think of 'squash (rebase -i (squash))' as different from 'rebase over 
branch'

Sure you can club both operations - assuming that's the intention.

In some cases its preferable to only do the squash - and not rebase
(over main). For ex: when you successfully run a test pipeline - best
to do 'squash-only' (after testing) to keep the test results current.

Satish

> 
> 
> >
> >   Barry
> >
> > so I try to rebase -i before rebasing over main. Then rebase over main and
> > you have a clean and updated branch.
> >
> > 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.
> >
> > On Tue, Mar 2, 2021 at 10:02 PM Junchao Zhang 
> > wrote:
> >
> >> I am a naive git user, so I use interactive git rebase.  Suppose I am on
> >> the branch I want to modify,
> >>
> >> 1) Use git graph to locate an upstream commit to be used as the base
> >> $ git graph
> >> * 0d5433e9 (HEAD -> jczhang/sf-change-api) SF: rename SFCreateEmbeddedSF
> >> to SFCreateEmbeddedRootSF
> >> * e7314fbb SF: add an MPI_Op argument to SFBcast
> >> * 83df288d Replace MPIU_REPLACE with MPI_REPLACE
> >> *   b434c516 Merge branch
> >> 'barry/2021-02-02/petscsf-communication-specific' into 'main'
> >> |\
> >> | * 62152ded (barry/2021-02-02/petscsf-communication-specific)
> >> PetscSFView() never called viewer for the specific type (bug), hence many
> >> output files were incorrect.
> >> * |   a4f5d9b4 Merge branch 'jose/upgrade-magma' into 'main'
> >>
> >> 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
> >>   $ git rebase -i b434c516
> >> pick 83df288d Replace MPIU_REPLACE with MPI_REPLACE
> >> pick e7314fbb SF: add an MPI_Op argument to SFBcast
> >> pick 0d5433e9 SF: rename SFCreateEmbeddedSF to SFCreateEmbeddedRootSF
> >>
> >> # Rebase b434c516..0d5433e9 onto b434c516 (3 commands)
> >> #
> >> # Commands:
> >> # p, pick  = use commit
> >> # r, reword  = use commit, but edit the commit message
> >> # e, edit  = use commit, but stop for amending
> >> # s, squash  = use commit, but meld into previous commit
> >> # f, fixup  = like "squash", but discard this commit's log message
> >> # x, exec  = run command (the rest of the line) using shell
> >> # b, break = stop here (continue rebase later with 'git rebase
> >> --continue')
> >> # d, drop  = remove commit
> >> # l, label  = label current HEAD with a name
> >> # t, reset  = reset HEAD to a label
> >> # m, merge [-C  | -c ]  [# ]
> >> # .   create a merge commit using the original merge commit's
> >> # .   message (or the oneline, if no original merge commit was
> >> # .   specified). Use -c  to reword the commit message.
> >> #
> >> # These lines can be re-ordered; they are executed from top to bottom.
> >> #
> >> # If you remove a line here THAT COMMIT WILL BE LOST.
> >> #
> >> # However, if you remove everything, the rebase will be aborted.
> >> #
> >> # Note that empty commits are commented out
> >>
> >> 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
> >> pick 83df288d Replace MPIU_REPLACE with MPI_REPLACE
> >> s e7314fbb SF: add an MPI_Op argument to SFBcast
> >> s 0d5433e9 SF: rename SFCreateEmbeddedSF to SFCreateEmbeddedRootSF
> >>
> >> A new screen shows up
> >>
> >> # This is a combination of 3 commits.
> >> # This is the 1st commit message:
> >>
> >> Replace MPIU_REPLACE with MPI_REPLACE
> >>
> >> Since we believe all MPI implementations support MPI_REPLACE
> >>
> >> # This is the commit message #2:
> >>
> >> SF: add an MPI_Op argument to SFBcast
> >>
> >> # This is the commit message #3:
> >>
> >> SF: rename SFCreateEmbeddedSF to SFCreateEmbeddedRootSF
> >>
> >> # Please enter the commit message for your changes. Lines starting
> >> # with '#' will be ignored, and an empty message aborts the commit.
> >>
> >> 4) Edit the commit message as you want, save and exit, done!
> >>
> >> --Junchao Zhang
> >>
> >>
> >> On Tue, Mar 2, 2021 at 6:19 PM Blaise A Bourdin  wrote:
> >>
> >>> Hi,
> >>>
> >>> This is not 

Re: [petsc-dev] Commit squashing in MR

2021-03-03 Thread Mark Adams
On Tue, Mar 2, 2021 at 11:33 PM Jed Brown  wrote:

> Satish Balay via petsc-dev  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)
>
>
Oh, this has a side effect that can not be undone with some sort of simple
--abort.

Not for me and  Blaise.


> 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.
>

Humm, sounds interesting. I'll try it. Looks simple.


Re: [petsc-dev] Commit squashing in MR

2021-03-03 Thread Mark Adams
On Tue, Mar 2, 2021 at 11:09 PM Jacob Faibussowitsch 
wrote:

>   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.
>
>
> Mark, do you rebase your branch over main first or do you merge main intro
> your branch to update it?
>

I never merge anymore. just rebase over main.


> If you rebase, you can pick an N such that you only get your commits from
> the branch.
>

Yea, but what is N? If you know that then use it. I just guess if I lose
track (I bounce between my Mac and two GPU machines so I can do a lot of
wip commits) and as long as you guess too big, you will see where your
commits start and ignore the rest.


>
> Best regards,
>
> Jacob Faibussowitsch
> (Jacob Fai - booss - oh - vitch)
> Cell: (312) 694-3391
>
> On Mar 2, 2021, at 22:02, Barry Smith  wrote:
>
>
>
> On Mar 2, 2021, at 9:24 PM, Mark Adams  wrote:
>
> Ah, 'git graph' I will try that next time.
>
> I use 'git rebase -i HEAD~N', but you need an N.
>
> After you 'git rebase origin/main' you get other commits interspersed in
> with yours,
>
>
>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.
>
>   Barry
>
> so I try to rebase -i before rebasing over main. Then rebase over main and
> you have a clean and updated branch.
>
> 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.
>
> On Tue, Mar 2, 2021 at 10:02 PM Junchao Zhang 
> wrote:
>
>> I am a naive git user, so I use interactive git rebase.  Suppose I am on
>> the branch I want to modify,
>>
>> 1) Use git graph to locate an upstream commit to be used as the base
>> $ git graph
>> * 0d5433e9 (HEAD -> jczhang/sf-change-api) SF: rename SFCreateEmbeddedSF
>> to SFCreateEmbeddedRootSF
>> * e7314fbb SF: add an MPI_Op argument to SFBcast
>> * 83df288d Replace MPIU_REPLACE with MPI_REPLACE
>> *   b434c516 Merge branch
>> 'barry/2021-02-02/petscsf-communication-specific' into 'main'
>> |\
>> | * 62152ded (barry/2021-02-02/petscsf-communication-specific)
>> PetscSFView() never called viewer for the specific type (bug), hence many
>> output files were incorrect.
>> * |   a4f5d9b4 Merge branch 'jose/upgrade-magma' into 'main'
>>
>> 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
>>   $ git rebase -i b434c516
>> pick 83df288d Replace MPIU_REPLACE with MPI_REPLACE
>> pick e7314fbb SF: add an MPI_Op argument to SFBcast
>> pick 0d5433e9 SF: rename SFCreateEmbeddedSF to SFCreateEmbeddedRootSF
>>
>> # Rebase b434c516..0d5433e9 onto b434c516 (3 commands)
>> #
>> # Commands:
>> # p, pick  = use commit
>> # r, reword  = use commit, but edit the commit message
>> # e, edit  = use commit, but stop for amending
>> # s, squash  = use commit, but meld into previous commit
>> # f, fixup  = like "squash", but discard this commit's log message
>> # x, exec  = run command (the rest of the line) using shell
>> # b, break = stop here (continue rebase later with 'git rebase
>> --continue')
>> # d, drop  = remove commit
>> # l, label  = label current HEAD with a name
>> # t, reset  = reset HEAD to a label
>> # m, merge [-C  | -c ]  [# ]
>> # .   create a merge commit using the original merge commit's
>> # .   message (or the oneline, if no original merge commit was
>> # .   specified). Use -c  to reword the commit message.
>> #
>> # These lines can be re-ordered; they are executed from top to bottom.
>> #
>> # If you remove a line here THAT COMMIT WILL BE LOST.
>> #
>> # However, if you remove everything, the rebase will be aborted.
>> #
>> # Note that empty commits are commented out
>>
>> 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
>> pick 83df288d Replace MPIU_REPLACE with MPI_REPLACE
>> s e7314fbb SF: add an MPI_Op argument to SFBcast
>> s 0d5433e9 SF: rename SFCreateEmbeddedSF to SFCreateEmbeddedRootSF
>>
>> A new screen shows up
>>
>> # This is a combination of 3 commits.
>> # This is the 1st commit message:
>>
>> Replace MPIU_REPLACE with MPI_REPLACE
>>
>> Since we believe all MPI implementations support MPI_REPLACE
>>
>> # This is the commit message #2:
>>
>> SF: add an MPI_Op argument to SFBcast
>>
>> # This is the commit message #3:
>>
>> SF: rename SFCreateEmbeddedSF to SFCreateEmbeddedRootSF
>>
>> # Please enter the commit message for your changes. Lines starting
>> # with '#' will be ignored, and an empty message aborts the commit.
>>
>> 4) Edit the commit message as you want, save and exit, done!
>>
>> --Junchao Zhang
>>
>>
>> On Tue, Mar 2, 2021 at 6:19 PM Blaise A Bourdin  

Re: [petsc-dev] Commit squashing in MR

2021-03-03 Thread Mark Adams
On Tue, Mar 2, 2021 at 11:02 PM Barry Smith  wrote:

>
>
> On Mar 2, 2021, at 9:24 PM, Mark Adams  wrote:
>
> Ah, 'git graph' I will try that next time.
>
> I use 'git rebase -i HEAD~N', but you need an N.
>
> After you 'git rebase origin/main' you get other commits interspersed in
> with yours,
>
>
>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.
>

Humm, I'm not sure. The important thing is that you will hit main commits
and you don't want to touch those or the first of your commits.


>
>   Barry
>
> so I try to rebase -i before rebasing over main. Then rebase over main and
> you have a clean and updated branch.
>
> 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.
>
> On Tue, Mar 2, 2021 at 10:02 PM Junchao Zhang 
> wrote:
>
>> I am a naive git user, so I use interactive git rebase.  Suppose I am on
>> the branch I want to modify,
>>
>> 1) Use git graph to locate an upstream commit to be used as the base
>> $ git graph
>> * 0d5433e9 (HEAD -> jczhang/sf-change-api) SF: rename SFCreateEmbeddedSF
>> to SFCreateEmbeddedRootSF
>> * e7314fbb SF: add an MPI_Op argument to SFBcast
>> * 83df288d Replace MPIU_REPLACE with MPI_REPLACE
>> *   b434c516 Merge branch
>> 'barry/2021-02-02/petscsf-communication-specific' into 'main'
>> |\
>> | * 62152ded (barry/2021-02-02/petscsf-communication-specific)
>> PetscSFView() never called viewer for the specific type (bug), hence many
>> output files were incorrect.
>> * |   a4f5d9b4 Merge branch 'jose/upgrade-magma' into 'main'
>>
>> 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
>>   $ git rebase -i b434c516
>> pick 83df288d Replace MPIU_REPLACE with MPI_REPLACE
>> pick e7314fbb SF: add an MPI_Op argument to SFBcast
>> pick 0d5433e9 SF: rename SFCreateEmbeddedSF to SFCreateEmbeddedRootSF
>>
>> # Rebase b434c516..0d5433e9 onto b434c516 (3 commands)
>> #
>> # Commands:
>> # p, pick  = use commit
>> # r, reword  = use commit, but edit the commit message
>> # e, edit  = use commit, but stop for amending
>> # s, squash  = use commit, but meld into previous commit
>> # f, fixup  = like "squash", but discard this commit's log message
>> # x, exec  = run command (the rest of the line) using shell
>> # b, break = stop here (continue rebase later with 'git rebase
>> --continue')
>> # d, drop  = remove commit
>> # l, label  = label current HEAD with a name
>> # t, reset  = reset HEAD to a label
>> # m, merge [-C  | -c ]  [# ]
>> # .   create a merge commit using the original merge commit's
>> # .   message (or the oneline, if no original merge commit was
>> # .   specified). Use -c  to reword the commit message.
>> #
>> # These lines can be re-ordered; they are executed from top to bottom.
>> #
>> # If you remove a line here THAT COMMIT WILL BE LOST.
>> #
>> # However, if you remove everything, the rebase will be aborted.
>> #
>> # Note that empty commits are commented out
>>
>> 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
>> pick 83df288d Replace MPIU_REPLACE with MPI_REPLACE
>> s e7314fbb SF: add an MPI_Op argument to SFBcast
>> s 0d5433e9 SF: rename SFCreateEmbeddedSF to SFCreateEmbeddedRootSF
>>
>> A new screen shows up
>>
>> # This is a combination of 3 commits.
>> # This is the 1st commit message:
>>
>> Replace MPIU_REPLACE with MPI_REPLACE
>>
>> Since we believe all MPI implementations support MPI_REPLACE
>>
>> # This is the commit message #2:
>>
>> SF: add an MPI_Op argument to SFBcast
>>
>> # This is the commit message #3:
>>
>> SF: rename SFCreateEmbeddedSF to SFCreateEmbeddedRootSF
>>
>> # Please enter the commit message for your changes. Lines starting
>> # with '#' will be ignored, and an empty message aborts the commit.
>>
>> 4) Edit the commit message as you want, save and exit, done!
>>
>> --Junchao Zhang
>>
>>
>> On Tue, Mar 2, 2021 at 6:19 PM 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?
>>>
>>> Regards,
>>> Blaise
>>>
>>> --
>>> A.K. & Shirley Barton Professor of  Mathematics
>>> Adjunct Professor of Mechanical Engineering
>>> Adjunct of the Center for Computation & Technology
>>> Louisiana State University, Lockett Hall Room 344, Baton Rouge, LA
>>> 70803, USA
>>> Tel. +1 (225) 578 1612, Fax  +1 (225) 578 4276 Web
>>> http://www.math.lsu.edu/~bourdin
>>>
>>>
>


Re: [petsc-dev] Commit squashing in MR

2021-03-03 Thread Zhang, Hong via petsc-dev
Patrick,
I need update petsc manual on DMNetwork, but do not know how to proceed. I 
tried your suggested steps:
1) go to the docs page you want to edit on 
docs.petsc.org<http://docs.petsc.org/>
2) select the version you want (usually "main") in the black ReadTheDocs box in 
the lower right
3) click "edit" in "on GitLab" and make your MR (name the branch with "docs-" 
to maybe get it to auto-build on ReadTheDocs, label with docs and docs-only)

I do not understand 3). Can you give a tutorial demo in next petsc meeting?
Hong

From: petsc-dev  on behalf of Patrick Sanan 

Sent: Wednesday, March 3, 2021 12:23 AM
To: Jed Brown 
Cc: Satish Balay via petsc-dev 
Subject: Re: [petsc-dev] Commit squashing in MR

The whole section on git in the dev manual needs some attention. (It was moved 
there in the consolidation of docs we had scattered in various places, but 
hasn't been expertly updated yet). Ideal, I think, would be to find some good, 
external instructions and link to them, under the idea that we should only 
maintain things in our own docs that aren't adequately documented somewhere 
else. This might not be possible (since we had to create these instructions in 
the first place).

There is a section on squashing but it's currently a bit buried, and the advice 
in this thread is probably more useful/current
https://docs.petsc.org/en/main/developers/integration/#squashing-excessive-commits

If anyone wants to go in there and quickly update those docs, remember that you 
can do so all from web interfaces! This workflow still has some wrinkles, but 
for small changes I still think it's appealing:

- go to the docs page you want to edit on docs.petsc.org<http://docs.petsc.org>
- select the version you want (usually "main") in the black ReadTheDocs box in 
the lower right
- click "edit" in "on GitLab" and make your MR (name the branch with "docs-" to 
maybe get it to auto-build on ReadTheDocs, label with docs and docs-only)
- if you get feedback on your MR and need to update, or notice a typo, I 
*think* this will work:
   - click on the last commit of your new branch
   - find the offending file
   - click on "edit at @deadbeef123"
- change the branch *back* to your branch in the pulldown
- click "edit"
- back in your MR, edit to "squash commits"

You can get a partial preview with the usual "preview" button, though not 
everything is interpreted correctly (but for things like links, it works fine).

If you want a full preview, you can

1. Build the Sphinx docs locally from your branch, either with
- "make sphinx-docs-all LOC=$PETSC_DIR"  (you may need to add PYTHON=python3, 
since this relies on Python 3.3+ for venv)
- install the required Python packages yourself (e.g. pip install -r 
src/docs/sphinx_docs/requirements.txt), go to src/docs/sphinx_docs, run "make 
html", and look in _build/html

2. Build the Sphinx docs for your branch as a version on ReadTheDocs. There is 
currently an automation rule there that if your branch name has "docs-" in it, 
it should build (though I must admit I'm still not completely sure I understand 
exactly when RTD updates its information from GitLab). Or, if you have access, 
you can activate a new version yourself.



Am 03.03.2021 um 05:32 schrieb Jed Brown 
mailto:j...@jedbrown.org>>:

Satish Balay via petsc-dev 
mailto:petsc-dev@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.



Re: [petsc-dev] Commit squashing in MR

2021-03-02 Thread Patrick Sanan
The whole section on git in the dev manual needs some attention. (It was moved 
there in the consolidation of docs we had scattered in various places, but 
hasn't been expertly updated yet). Ideal, I think, would be to find some good, 
external instructions and link to them, under the idea that we should only 
maintain things in our own docs that aren't adequately documented somewhere 
else. This might not be possible (since we had to create these instructions in 
the first place).

There is a section on squashing but it's currently a bit buried, and the advice 
in this thread is probably more useful/current
https://docs.petsc.org/en/main/developers/integration/#squashing-excessive-commits
 


If anyone wants to go in there and quickly update those docs, remember that you 
can do so all from web interfaces! This workflow still has some wrinkles, but 
for small changes I still think it's appealing:

- go to the docs page you want to edit on docs.petsc.org
- select the version you want (usually "main") in the black ReadTheDocs box in 
the lower right
- click "edit" in "on GitLab" and make your MR (name the branch with "docs-" to 
maybe get it to auto-build on ReadTheDocs, label with docs and docs-only)
- if you get feedback on your MR and need to update, or notice a typo, I 
*think* this will work:
   - click on the last commit of your new branch
   - find the offending file
   - click on "edit at @deadbeef123"
- change the branch *back* to your branch in the pulldown
- click "edit"
- back in your MR, edit to "squash commits"

You can get a partial preview with the usual "preview" button, though not 
everything is interpreted correctly (but for things like links, it works fine).

If you want a full preview, you can

1. Build the Sphinx docs locally from your branch, either with
- "make sphinx-docs-all LOC=$PETSC_DIR"  (you may need to add 
PYTHON=python3, since this relies on Python 3.3+ for venv) 
- install the required Python packages yourself (e.g. pip install -r 
src/docs/sphinx_docs/requirements.txt), go to src/docs/sphinx_docs, run "make 
html", and look in _build/html

2. Build the Sphinx docs for your branch as a version on ReadTheDocs. There is 
currently an automation rule there that if your branch name has "docs-" in it, 
it should build (though I must admit I'm still not completely sure I understand 
exactly when RTD updates its information from GitLab). Or, if you have access, 
you can activate a new version yourself.



> Am 03.03.2021 um 05:32 schrieb Jed Brown :
> 
> Satish Balay via petsc-dev  > 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.



Re: [petsc-dev] Commit squashing in MR

2021-03-02 Thread Jed Brown
Satish Balay via petsc-dev  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.


Re: [petsc-dev] Commit squashing in MR

2021-03-02 Thread Barry Smith


> On Mar 2, 2021, at 10:09 PM, Jacob Faibussowitsch  wrote:
> 
>>   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.
> 
> 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.

   I just do 

git rebase main   (from my branch) 

 I don't need to provide an N, it automatically puts all the new changes in 
main BEFORE my commits in my branch. I would never merge my branch with main.

I put the N in when I am rebasing my branch "against itself" and trying to 
organize the commits within my branch. By having the N be within the range of 
my commits it means I am just reorganizing my commits and not messing with any 
previous commits that came before my branch.




> 
> Best regards,
> 
> Jacob Faibussowitsch
> (Jacob Fai - booss - oh - vitch)
> Cell: (312) 694-3391
> 
>> On Mar 2, 2021, at 22:02, Barry Smith > > wrote:
>> 
>> 
>> 
>>> On Mar 2, 2021, at 9:24 PM, Mark Adams >> > wrote:
>>> 
>>> Ah, 'git graph' I will try that next time.
>>> 
>>> I use 'git rebase -i HEAD~N', but you need an N. 
>>> 
>>> After you 'git rebase origin/main' you get other commits interspersed in 
>>> with yours,
>> 
>>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.
>> 
>>   Barry
>> 
>>> so I try to rebase -i before rebasing over main. Then rebase over main and 
>>> you have a clean and updated branch. 
>>> 
>>> 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.
>>> 
>>> On Tue, Mar 2, 2021 at 10:02 PM Junchao Zhang >> > wrote:
>>> I am a naive git user, so I use interactive git rebase.  Suppose I am on 
>>> the branch I want to modify, 
>>> 
>>> 1) Use git graph to locate an upstream commit to be used as the base
>>> $ git graph
>>> * 0d5433e9 (HEAD -> jczhang/sf-change-api) SF: rename SFCreateEmbeddedSF to 
>>> SFCreateEmbeddedRootSF
>>> * e7314fbb SF: add an MPI_Op argument to SFBcast
>>> * 83df288d Replace MPIU_REPLACE with MPI_REPLACE
>>> *   b434c516 Merge branch 'barry/2021-02-02/petscsf-communication-specific' 
>>> into 'main'
>>> |\
>>> | * 62152ded (barry/2021-02-02/petscsf-communication-specific) 
>>> PetscSFView() never called viewer for the specific type (bug), hence many 
>>> output files were incorrect.
>>> * |   a4f5d9b4 Merge branch 'jose/upgrade-magma' into 'main'
>>> 
>>> 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
>>>   $ git rebase -i b434c516
>>> pick 83df288d Replace MPIU_REPLACE with MPI_REPLACE
>>> pick e7314fbb SF: add an MPI_Op argument to SFBcast
>>> pick 0d5433e9 SF: rename SFCreateEmbeddedSF to SFCreateEmbeddedRootSF
>>> 
>>> # Rebase b434c516..0d5433e9 onto b434c516 (3 commands)
>>> #
>>> # Commands:
>>> # p, pick  = use commit
>>> # r, reword  = use commit, but edit the commit message
>>> # e, edit  = use commit, but stop for amending
>>> # s, squash  = use commit, but meld into previous commit
>>> # f, fixup  = like "squash", but discard this commit's log message
>>> # x, exec  = run command (the rest of the line) using shell
>>> # b, break = stop here (continue rebase later with 'git rebase --continue')
>>> # d, drop  = remove commit
>>> # l, label  = label current HEAD with a name
>>> # t, reset  = reset HEAD to a label
>>> # m, merge [-C  | -c ]  [# ]
>>> # .   create a merge commit using the original merge commit's
>>> # .   message (or the oneline, if no original merge commit was
>>> # .   specified). Use -c  to reword the commit message.
>>> #
>>> # These lines can be re-ordered; they are executed from top to bottom.
>>> #
>>> # If you remove a line here THAT COMMIT WILL BE LOST.
>>> #
>>> # However, if you remove everything, the rebase will be aborted.
>>> #
>>> # Note that empty commits are commented out
>>> 
>>> 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
>>> pick 83df288d Replace MPIU_REPLACE with MPI_REPLACE
>>> s e7314fbb SF: add an MPI_Op argument to SFBcast
>>> s 0d5433e9 SF: rename SFCreateEmbeddedSF to SFCreateEmbeddedRootSF
>>> 
>>> A new screen shows up
>>> 
>>> # This is a combination of 3 commits.
>>> # This is the 1st commit message:
>>> 
>>> Replace MPIU_REPLACE with MPI_REPLACE
>>> 
>>> Since we believe all MPI implementations support MPI_REPLACE
>>> 
>>> # This is the commit message #2:
>>> 
>>> 

Re: [petsc-dev] Commit squashing in MR

2021-03-02 Thread Jacob Faibussowitsch
>   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.

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.

Best regards,

Jacob Faibussowitsch
(Jacob Fai - booss - oh - vitch)
Cell: (312) 694-3391

> On Mar 2, 2021, at 22:02, Barry Smith  wrote:
> 
> 
> 
>> On Mar 2, 2021, at 9:24 PM, Mark Adams > > wrote:
>> 
>> Ah, 'git graph' I will try that next time.
>> 
>> I use 'git rebase -i HEAD~N', but you need an N. 
>> 
>> After you 'git rebase origin/main' you get other commits interspersed in 
>> with yours,
> 
>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.
> 
>   Barry
> 
>> so I try to rebase -i before rebasing over main. Then rebase over main and 
>> you have a clean and updated branch. 
>> 
>> 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.
>> 
>> On Tue, Mar 2, 2021 at 10:02 PM Junchao Zhang > > wrote:
>> I am a naive git user, so I use interactive git rebase.  Suppose I am on the 
>> branch I want to modify, 
>> 
>> 1) Use git graph to locate an upstream commit to be used as the base
>> $ git graph
>> * 0d5433e9 (HEAD -> jczhang/sf-change-api) SF: rename SFCreateEmbeddedSF to 
>> SFCreateEmbeddedRootSF
>> * e7314fbb SF: add an MPI_Op argument to SFBcast
>> * 83df288d Replace MPIU_REPLACE with MPI_REPLACE
>> *   b434c516 Merge branch 'barry/2021-02-02/petscsf-communication-specific' 
>> into 'main'
>> |\
>> | * 62152ded (barry/2021-02-02/petscsf-communication-specific) PetscSFView() 
>> never called viewer for the specific type (bug), hence many output files 
>> were incorrect.
>> * |   a4f5d9b4 Merge branch 'jose/upgrade-magma' into 'main'
>> 
>> 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
>>   $ git rebase -i b434c516
>> pick 83df288d Replace MPIU_REPLACE with MPI_REPLACE
>> pick e7314fbb SF: add an MPI_Op argument to SFBcast
>> pick 0d5433e9 SF: rename SFCreateEmbeddedSF to SFCreateEmbeddedRootSF
>> 
>> # Rebase b434c516..0d5433e9 onto b434c516 (3 commands)
>> #
>> # Commands:
>> # p, pick  = use commit
>> # r, reword  = use commit, but edit the commit message
>> # e, edit  = use commit, but stop for amending
>> # s, squash  = use commit, but meld into previous commit
>> # f, fixup  = like "squash", but discard this commit's log message
>> # x, exec  = run command (the rest of the line) using shell
>> # b, break = stop here (continue rebase later with 'git rebase --continue')
>> # d, drop  = remove commit
>> # l, label  = label current HEAD with a name
>> # t, reset  = reset HEAD to a label
>> # m, merge [-C  | -c ]  [# ]
>> # .   create a merge commit using the original merge commit's
>> # .   message (or the oneline, if no original merge commit was
>> # .   specified). Use -c  to reword the commit message.
>> #
>> # These lines can be re-ordered; they are executed from top to bottom.
>> #
>> # If you remove a line here THAT COMMIT WILL BE LOST.
>> #
>> # However, if you remove everything, the rebase will be aborted.
>> #
>> # Note that empty commits are commented out
>> 
>> 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
>> pick 83df288d Replace MPIU_REPLACE with MPI_REPLACE
>> s e7314fbb SF: add an MPI_Op argument to SFBcast
>> s 0d5433e9 SF: rename SFCreateEmbeddedSF to SFCreateEmbeddedRootSF
>> 
>> A new screen shows up
>> 
>> # This is a combination of 3 commits.
>> # This is the 1st commit message:
>> 
>> Replace MPIU_REPLACE with MPI_REPLACE
>> 
>> Since we believe all MPI implementations support MPI_REPLACE
>> 
>> # This is the commit message #2:
>> 
>> SF: add an MPI_Op argument to SFBcast
>> 
>> # This is the commit message #3:
>> 
>> SF: rename SFCreateEmbeddedSF to SFCreateEmbeddedRootSF
>> 
>> # Please enter the commit message for your changes. Lines starting
>> # with '#' will be ignored, and an empty message aborts the commit.
>> 
>> 4) Edit the commit message as you want, save and exit, done!
>> 
>> --Junchao Zhang
>> 
>> 
>> On Tue, Mar 2, 2021 at 6:19 PM 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 

Re: [petsc-dev] Commit squashing in MR

2021-03-02 Thread Barry Smith


> On Mar 2, 2021, at 9:24 PM, Mark Adams  wrote:
> 
> Ah, 'git graph' I will try that next time.
> 
> I use 'git rebase -i HEAD~N', but you need an N. 
> 
> After you 'git rebase origin/main' you get other commits interspersed in with 
> yours,

   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.

  Barry

> so I try to rebase -i before rebasing over main. Then rebase over main and 
> you have a clean and updated branch. 
> 
> 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.
> 
> On Tue, Mar 2, 2021 at 10:02 PM Junchao Zhang  > wrote:
> I am a naive git user, so I use interactive git rebase.  Suppose I am on the 
> branch I want to modify, 
> 
> 1) Use git graph to locate an upstream commit to be used as the base
> $ git graph
> * 0d5433e9 (HEAD -> jczhang/sf-change-api) SF: rename SFCreateEmbeddedSF to 
> SFCreateEmbeddedRootSF
> * e7314fbb SF: add an MPI_Op argument to SFBcast
> * 83df288d Replace MPIU_REPLACE with MPI_REPLACE
> *   b434c516 Merge branch 'barry/2021-02-02/petscsf-communication-specific' 
> into 'main'
> |\
> | * 62152ded (barry/2021-02-02/petscsf-communication-specific) PetscSFView() 
> never called viewer for the specific type (bug), hence many output files were 
> incorrect.
> * |   a4f5d9b4 Merge branch 'jose/upgrade-magma' into 'main'
> 
> 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
>   $ git rebase -i b434c516
> pick 83df288d Replace MPIU_REPLACE with MPI_REPLACE
> pick e7314fbb SF: add an MPI_Op argument to SFBcast
> pick 0d5433e9 SF: rename SFCreateEmbeddedSF to SFCreateEmbeddedRootSF
> 
> # Rebase b434c516..0d5433e9 onto b434c516 (3 commands)
> #
> # Commands:
> # p, pick  = use commit
> # r, reword  = use commit, but edit the commit message
> # e, edit  = use commit, but stop for amending
> # s, squash  = use commit, but meld into previous commit
> # f, fixup  = like "squash", but discard this commit's log message
> # x, exec  = run command (the rest of the line) using shell
> # b, break = stop here (continue rebase later with 'git rebase --continue')
> # d, drop  = remove commit
> # l, label  = label current HEAD with a name
> # t, reset  = reset HEAD to a label
> # m, merge [-C  | -c ]  [# ]
> # .   create a merge commit using the original merge commit's
> # .   message (or the oneline, if no original merge commit was
> # .   specified). Use -c  to reword the commit message.
> #
> # These lines can be re-ordered; they are executed from top to bottom.
> #
> # If you remove a line here THAT COMMIT WILL BE LOST.
> #
> # However, if you remove everything, the rebase will be aborted.
> #
> # Note that empty commits are commented out
> 
> 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
> pick 83df288d Replace MPIU_REPLACE with MPI_REPLACE
> s e7314fbb SF: add an MPI_Op argument to SFBcast
> s 0d5433e9 SF: rename SFCreateEmbeddedSF to SFCreateEmbeddedRootSF
> 
> A new screen shows up
> 
> # This is a combination of 3 commits.
> # This is the 1st commit message:
> 
> Replace MPIU_REPLACE with MPI_REPLACE
> 
> Since we believe all MPI implementations support MPI_REPLACE
> 
> # This is the commit message #2:
> 
> SF: add an MPI_Op argument to SFBcast
> 
> # This is the commit message #3:
> 
> SF: rename SFCreateEmbeddedSF to SFCreateEmbeddedRootSF
> 
> # Please enter the commit message for your changes. Lines starting
> # with '#' will be ignored, and an empty message aborts the commit.
> 
> 4) Edit the commit message as you want, save and exit, done!
> 
> --Junchao Zhang
> 
> 
> On Tue, Mar 2, 2021 at 6:19 PM 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?
> 
> Regards,
> Blaise
> 
> -- 
> A.K. & Shirley Barton Professor of  Mathematics
> Adjunct Professor of Mechanical Engineering
> Adjunct of the Center for Computation & Technology
> Louisiana State University, Lockett Hall Room 344, Baton Rouge, LA 70803, USA
> Tel. +1 (225) 578 1612, Fax  +1 (225) 578 4276 Web 
> http://www.math.lsu.edu/~bourdin 
> 



Re: [petsc-dev] Commit squashing in MR

2021-03-02 Thread Satish Balay via petsc-dev
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]

Satish

> 
> Regards,
> Blaise
>  
> 



Re: [petsc-dev] Commit squashing in MR

2021-03-02 Thread Mark Adams
Ah, 'git graph' I will try that next time.

I use 'git rebase -i HEAD~N', but you need an N.

After you 'git rebase origin/main' you get other commits interspersed in
with yours, so I try to rebase -i before rebasing over main. Then rebase
over main and you have a clean and updated branch.

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.

On Tue, Mar 2, 2021 at 10:02 PM Junchao Zhang 
wrote:

> I am a naive git user, so I use interactive git rebase.  Suppose I am on
> the branch I want to modify,
>
> 1) Use git graph to locate an upstream commit to be used as the base
> $ git graph
> * 0d5433e9 (HEAD -> jczhang/sf-change-api) SF: rename SFCreateEmbeddedSF
> to SFCreateEmbeddedRootSF
> * e7314fbb SF: add an MPI_Op argument to SFBcast
> * 83df288d Replace MPIU_REPLACE with MPI_REPLACE
> *   b434c516 Merge branch
> 'barry/2021-02-02/petscsf-communication-specific' into 'main'
> |\
> | * 62152ded (barry/2021-02-02/petscsf-communication-specific)
> PetscSFView() never called viewer for the specific type (bug), hence many
> output files were incorrect.
> * |   a4f5d9b4 Merge branch 'jose/upgrade-magma' into 'main'
>
> 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
>   $ git rebase -i b434c516
> pick 83df288d Replace MPIU_REPLACE with MPI_REPLACE
> pick e7314fbb SF: add an MPI_Op argument to SFBcast
> pick 0d5433e9 SF: rename SFCreateEmbeddedSF to SFCreateEmbeddedRootSF
>
> # Rebase b434c516..0d5433e9 onto b434c516 (3 commands)
> #
> # Commands:
> # p, pick  = use commit
> # r, reword  = use commit, but edit the commit message
> # e, edit  = use commit, but stop for amending
> # s, squash  = use commit, but meld into previous commit
> # f, fixup  = like "squash", but discard this commit's log message
> # x, exec  = run command (the rest of the line) using shell
> # b, break = stop here (continue rebase later with 'git rebase --continue')
> # d, drop  = remove commit
> # l, label  = label current HEAD with a name
> # t, reset  = reset HEAD to a label
> # m, merge [-C  | -c ]  [# ]
> # .   create a merge commit using the original merge commit's
> # .   message (or the oneline, if no original merge commit was
> # .   specified). Use -c  to reword the commit message.
> #
> # These lines can be re-ordered; they are executed from top to bottom.
> #
> # If you remove a line here THAT COMMIT WILL BE LOST.
> #
> # However, if you remove everything, the rebase will be aborted.
> #
> # Note that empty commits are commented out
>
> 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
> pick 83df288d Replace MPIU_REPLACE with MPI_REPLACE
> s e7314fbb SF: add an MPI_Op argument to SFBcast
> s 0d5433e9 SF: rename SFCreateEmbeddedSF to SFCreateEmbeddedRootSF
>
> A new screen shows up
>
> # This is a combination of 3 commits.
> # This is the 1st commit message:
>
> Replace MPIU_REPLACE with MPI_REPLACE
>
> Since we believe all MPI implementations support MPI_REPLACE
>
> # This is the commit message #2:
>
> SF: add an MPI_Op argument to SFBcast
>
> # This is the commit message #3:
>
> SF: rename SFCreateEmbeddedSF to SFCreateEmbeddedRootSF
>
> # Please enter the commit message for your changes. Lines starting
> # with '#' will be ignored, and an empty message aborts the commit.
>
> 4) Edit the commit message as you want, save and exit, done!
>
> --Junchao Zhang
>
>
> On Tue, Mar 2, 2021 at 6:19 PM 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?
>>
>> Regards,
>> Blaise
>>
>> --
>> A.K. & Shirley Barton Professor of  Mathematics
>> Adjunct Professor of Mechanical Engineering
>> Adjunct of the Center for Computation & Technology
>> Louisiana State University, Lockett Hall Room 344, Baton Rouge, LA 70803,
>> USA
>> Tel. +1 (225) 578 1612, Fax  +1 (225) 578 4276 Web
>> http://www.math.lsu.edu/~bourdin
>>
>>


Re: [petsc-dev] Commit squashing in MR

2021-03-02 Thread Junchao Zhang
I am a naive git user, so I use interactive git rebase.  Suppose I am on
the branch I want to modify,

1) Use git graph to locate an upstream commit to be used as the base
$ git graph
* 0d5433e9 (HEAD -> jczhang/sf-change-api) SF: rename SFCreateEmbeddedSF to
SFCreateEmbeddedRootSF
* e7314fbb SF: add an MPI_Op argument to SFBcast
* 83df288d Replace MPIU_REPLACE with MPI_REPLACE
*   b434c516 Merge branch 'barry/2021-02-02/petscsf-communication-specific'
into 'main'
|\
| * 62152ded (barry/2021-02-02/petscsf-communication-specific)
PetscSFView() never called viewer for the specific type (bug), hence many
output files were incorrect.
* |   a4f5d9b4 Merge branch 'jose/upgrade-magma' into 'main'

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
  $ git rebase -i b434c516
pick 83df288d Replace MPIU_REPLACE with MPI_REPLACE
pick e7314fbb SF: add an MPI_Op argument to SFBcast
pick 0d5433e9 SF: rename SFCreateEmbeddedSF to SFCreateEmbeddedRootSF

# Rebase b434c516..0d5433e9 onto b434c516 (3 commands)
#
# Commands:
# p, pick  = use commit
# r, reword  = use commit, but edit the commit message
# e, edit  = use commit, but stop for amending
# s, squash  = use commit, but meld into previous commit
# f, fixup  = like "squash", but discard this commit's log message
# x, exec  = run command (the rest of the line) using shell
# b, break = stop here (continue rebase later with 'git rebase --continue')
# d, drop  = remove commit
# l, label  = label current HEAD with a name
# t, reset  = reset HEAD to a label
# m, merge [-C  | -c ]  [# ]
# .   create a merge commit using the original merge commit's
# .   message (or the oneline, if no original merge commit was
# .   specified). Use -c  to reword the commit message.
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out

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
pick 83df288d Replace MPIU_REPLACE with MPI_REPLACE
s e7314fbb SF: add an MPI_Op argument to SFBcast
s 0d5433e9 SF: rename SFCreateEmbeddedSF to SFCreateEmbeddedRootSF

A new screen shows up

# This is a combination of 3 commits.
# This is the 1st commit message:

Replace MPIU_REPLACE with MPI_REPLACE

Since we believe all MPI implementations support MPI_REPLACE

# This is the commit message #2:

SF: add an MPI_Op argument to SFBcast

# This is the commit message #3:

SF: rename SFCreateEmbeddedSF to SFCreateEmbeddedRootSF

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.

4) Edit the commit message as you want, save and exit, done!

--Junchao Zhang


On Tue, Mar 2, 2021 at 6:19 PM 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?
>
> Regards,
> Blaise
>
> --
> A.K. & Shirley Barton Professor of  Mathematics
> Adjunct Professor of Mechanical Engineering
> Adjunct of the Center for Computation & Technology
> Louisiana State University, Lockett Hall Room 344, Baton Rouge, LA 70803,
> USA
> Tel. +1 (225) 578 1612, Fax  +1 (225) 578 4276 Web
> http://www.math.lsu.edu/~bourdin
>
>