Re-syncing a package development branch to a modified master


#1

I fear that I am about to be in git purgatory again so this time I will ask for advice before doing things that get me in even deeper trouble.

I have a development branch, LowerCholesky, in the MixedModels package. This branch is about 60 commits ahead of the master branch and represents a substantial rewrite of the package.

I recently merged a pull request into master. It’s a small change, only affecting two lines, but I fear that this will come to haunt me when I try to merge my development branch into master.

What can I do now to prevent git making my life miserable when I try to merge the development branch? As I understand it, I shouldn’t rebase my development branch onto the new master. Should I try to merge the one new commit on master into the development branch?


#2

you could cherry pick the one commit

git checkout LowerCholesky 
git cherry-pick 979ae6e

but then you have to fix a little conflict

diff --cc src/pls.jl
index cd4e007,670f578..0000000
--- a/src/pls.jl
+++ b/src/pls.jl
@@@ -166,14 -216,10 +166,18 @@@ function StatsBase.fit!{T}(m::LinearMix
      opt = NLopt.Opt(optsum.optimizer, length(x))
      NLopt.ftol_rel!(opt, optsum.ftol_rel) # relative criterion on objective
      NLopt.ftol_abs!(opt, optsum.ftol_abs) # absolute criterion on objective
-     NLopt.xtol_rel!(opt, optsum.ftol_rel) # relative criterion on parameter values
+     NLopt.xtol_rel!(opt, optsum.xtol_rel) # relative criterion on parameter values
      NLopt.xtol_abs!(opt, optsum.xtol_abs) # absolute criterion on parameter values
      NLopt.lower_bounds!(opt, lb)
++<<<<<<< HEAD
 +    if isempty(optsum.initial_step)
 +        optsum.initial_step = NLopt.initial_step(opt, optsum.initial, similar(lb))
 +    else
 +        NLopt.initial_step!(opt, optsum.initial_step)
 +    end
++=======
+     NLopt.maxeval!(opt, optsum.feval)
++>>>>>>> 979ae6e... Fix NLopt relative solution tolerance, add max feval NLopt criterion (#75)
      feval = 0
      function obj(x, g)
          length(g) == 0 || error("gradient not defined")

after fixing this you git add src/pls.jl and git cherry-pick --continue

After that git log --oneline --graph --decorate should look something like

* cbd50a1 (HEAD, LowerCholesky) Fix NLopt relative solution tolerance, add max feval NLopt criterion (#75)
* c7614d1 (origin/LowerCholesky) Remove dead code. Use @argcheck
* bf7bd3f Remove debugging output
* d9fb0cf Add grouseticks example
* acdb86c Specify initial step in optimization

and the author is preserved as git log shows

commit cbd50a1e88e367fd02450e319336b81f7d410777
Author: Antoine <baldassarian@gmail.com>
Date:   Tue Mar 28 11:22:52 2017 -0400

    Fix NLopt relative solution tolerance, add max feval NLopt criterion (#75)
    
    The relative X tolerance criterion was previously set to optsum.ftol_rel
    (this may have been a typo). This change changes it to optsum.xtol_rel
    
    In addition, the NLopt maxeval stopping criterion was set to
    optsum.feval ( -1 by default)
    Conflicts:
        src/pls.jl

commit c7614d106991f006471a779714936600d82793ea
Author: Douglas Bates <dmbates@gmail.com>
Date:   Wed Mar 22 16:07:46 2017 -0500

    Remove dead code. Use @argcheck

#3

alternatively you can just merge master into LowerCholesky and fix the merge conflict there. This may be easier later when mergin LowerCholesky into master. It will, however, result in a merge commit


#4

Thank you. That is exactly what I need.


#5

actually, maybe go with the second suggestion (merge master into LowerCholesky), since otherwise I might have made your day a bit more difficult. sorry about that. I gravitate towards complicated solutions