A few times now I have wanted to update my ROOT version and keep my customizations, but I am very confused with all the git terminology. Also most git documentation seems to make different assumptions than the ROOT git repository, so I end up in strange places and lose my changes. I usually end up doing rm -rf and re-cloning the whole repo, making my manual changes again (as they are not extensive) and forgetting about git until the next ROOT version comes out.
Could someone proficient with git & who uses it for ROOT provide me a simple recipe to do the following:
Start with an empty directory and get the latest ROOT5 and ROOT6 versions separately.
Make manual edits to files in the local directories.
Update ROOT from the original repositories while maintaining my manual edits
I can basically already do 1 & 2, but then when I try 3, the various documentation & advice on IRC invariably messes up my working directories. I either lose my changes, or lose track of which ROOT version I am using, or end up with git errors that I don’t know how to recover from.
I am not a git expert but I can just tell you how I proceed. Basically I am doing the same as you i.e: importing latest mods from others while keeping my own changes.
The first thing I tried to find is some simplified interface to git. I found one (which I think is quite good) called SourceTree. I use it on Mac. I see it exists on Windows also. I am not sure about Linux. Nevertheless some other surely exist.
Then I did a “git clone” as explained on the ROOT web site. I attached this clone in SourceTree and from there I use mainly SourceTree. I am using the “stage”, “commit”, “push”, “pull” and “stash” functions
stage: in the list of uncommitted files just select those you want to stage. Then they are staged.
click “commit” to commit the staged files. It allows you to give a text explanation about the commit
once you did a commit, SourceTree tells you that there is a commit ready to be pushed (red mark next to the push button) to the reference repository.
click “push” to push it.
if some mods are available to be pulled from the repository, SourceTree tells you also (number of pulls next to the pull button). To get them just click the pull button
Before pulling changes it might be good to put on side the changes you have done doing a “stash”. Then you can pull safely and apply your mods doing un-stash (by right-clicking on the stash you want to apply on the left column).
By the way, are the mods you did of a general interest ?
Thanks for the advice Olivier, I will try using SourceTree. When you say you attached the cloned ROOT repository in SourceTree, what command/menu is that? I am able to add my local ROOT 5 and 6 repositories, but SourceTree isn’t noticing that they were cloned from somewhere.
My modifications are actually rather trivial. I am using a customized GSL where I added a new interpolation method (fork is here: github.com/jfcaron3/gsl-steffen-devel). Eventually the new interpolation will be in an official release of GSL, but they move very slowly. My modifications to ROOT itself are just adding an item to an enum and a switch/case so that ROOT knows about it. It’s literally one line in math/mathmore/inc/Math/InterpolationTypes.h and one in math/mathmore/src/GSLInterpolator.cxx
Once the new GSL version is out, I’ll submit a patch to ROOT itself so that the public can use the new interpolator through the Interpolator interface.
That said, if I was able to try additional modifications without fear of breaking my root installation, I might submit more patches for the kinds of features that I suggest, or fixes for the bugs I find.
In principle you’d want to keep the ROOT branch untouched, and instead have your change(s) in a separate branch off that ROOT branch. I.e.
mkdir ROOT; cd ROOT
mkdir 5; cd 5; git clone http://root.cern.ch/git/root.git src
cd src
git checkout v5-34-00-patches
git checkout -b new-gsl-ROOT5
patch -p0 < yourPatch.diff
git commit . -m 'Implement binding to new GSL function ...'
cd ..
mkdir obj; cd obj
../src/configure
make
cd ../../..
and similarly for the master:
cd ROOT
mkdir master; cd master; git clone http://root.cern.ch/git/root.git src
cd src
git checkout -b new-gsl-master
patch -p0 < yourPatch.diff
git commit . -m 'Implement binding to new GSL function ...'
cd ..
mkdir obj; cd obj
../src/configure
make
cd ../../..
When you want to update ROOT you do
cd ROOT/5/src
git checkout v5-34-00-patches
git pull
git checkout new-gsl-ROOT5
git rebase v5-34-00-patches