I need some git advice

Sandro Knauß sknauss at kde.org
Sat Jan 30 11:03:25 GMT 2021


Hey,

> I'd like to commit some changes to the akonadi repo, but my grasp of git is
> not firm.  The situation is
> 
>  * gabrielsf's commits 404bf743 and 805b31cc to master made most autotests
> work.  I'd like to get them onto the release branch without complicating
> future merges of release to master.
> 
>  * I have MR 47 that I would like to merge to release and thence to master.
> 
>  * In my local repo's branch I cherry-picked gabrielsf's commits and changed
> a test.  I haven't pushed the test up to my fork of akonadi, but I'd like
> to get the change into release and master.
> 
> How should I proceed?

You don't have to worry that much about merge conflicts. Because git only do 
merge of the commits, that were added on the release branch after the last 
time it was merged. That means, if you solved the merge for commits you don't 
have to do it afterwards again. So to keep the merge work simple, the best 
approach is to merge to master often. And in you case you know that the 
cherry-picked commits are already in master. So you just needs to make sure 
that the merge won't do anything in master branch.
I would suggest to:
* merge release to master before you cherry-pick
* cherry-pick 
* merge to master afterwards. If this triggers merge conflicts you make sure 
that you select the version of master. Or you tell git directly to use the 
merge strategy ours, but this will simply ignore any change on release branch.

git checkout master
git merge release/20.12
git checkout release/20.12
git cherry-pick 
git checkout master
git merge -s ours release/20.12

Sandro







More information about the kde-devel mailing list