[petsc-dev] does next model mess up our histories

Satish Balay balay at mcs.anl.gov
Wed Oct 1 23:57:53 CDT 2014


On Wed, 1 Oct 2014, Barry Smith wrote:

> >>  Ok, if this can be documented and made as simple as possible? A tool to do it? If it requires remember several arcane git commands to do and remember the  numbers of 5 merges you made, then forget it.
> > 
> > Perhaps Jed will reply with a simpler 'single' command to do the
> > revert all the merges from the feature branch - and an easy way to
> > verify.
> > 
> > Another option: [when the feature branch is ready for rebase/cleanup]
> > delegate the revert of the messy-feature branch to git guru :)
> 
>   And then not have it happen for how long? gurus unfortunately tend work work at their own schedule.

I think this is similar to a pull request workflow on which one of the
integrators would act upon.

BTW: the following URL has details of various scenarios wrt reverting.
[yeah many different senarios - and the git commands to deal with each
senario is slightly different]

https://www.kernel.org/pub/software/scm/git/docs/howto/revert-a-faulty-merge.html

The relavent section for the currently discussed issue is listed in
'ADDENDUM' - and it says:

1. do: revert
2. do: rebase -i --no-ff
3. do: merge

Note: the "--no-ff" is important when doing the branch cleanup for the subsequent merge
to be successful. [As a practical matter - I prefer to rename this branch when its cleaned up].

I just tried this out.. [on a 'test' branch thats equivalent to 'next'
- so I can discard it after my experiment]. And I'm doing this in a
clean clone.


*** get the list of merge commits in next [from barry/remove-sidl branch]

balay at asterix /home/balay/petsc (test)
$ git log  --merges --oneline --grep="Merge branch 'barry/remove-sidl' into next"
8ad988d Merge branch 'barry/remove-sidl' into next
738aa80 Merge branch 'barry/remove-sidl' into next
4f34d5f Merge branch 'barry/remove-sidl' into next
bcd5f70 Merge branch 'barry/remove-sidl' into next
6dc165f Merge branch 'barry/remove-sidl' into next
71fbb5e Merge branch 'barry/remove-sidl' into next
47c2055 Merge branch 'barry/remove-sidl' into next
7720b35 Merge branch 'barry/remove-sidl' into next

**** Now revert these merges in the correct order

git revert -m 1 8ad988d
git revert -m 1 738aa80
git revert -m 1 4f34d5f
git revert -m 1 bcd5f70
git revert -m 1 6dc165f
git revert -m 1 71fbb5e
git revert -m 1 47c2055
git revert -m 1 7720b35

*** Now rebase barry/remove-sidl [as barry/remove-sidl-test]

git co barry/remove-sidl
git co -b barry/remove-sidl-test
git rebase -i --no-ff 0166772

Note: 0166772 is the parent of the first commit in barry/remove-sidl-test branch
$ git log --parents --oneline master..barry/remove-sidl-test | tail -1
db23b12 0166772 remove a great deal of dead SIDL code from BuildSystem

*** Now merge the rebased stuff to next [aka my 'test' branch]

git co test
git merge barry/remove-sidl-test

*** Verify [in my case - 'next' and 'test' should be same - as my rebase didn't change anything]

balay at asterix /home/balay/tmp/petsc (test>)
$ git diff test origin/next
balay at asterix /home/balay/tmp/petsc (test>)

Satish



More information about the petsc-dev mailing list