(Replaced content with link to Community WIki.)
Line 1: Line 1:
{{warning|This page is yet to be reviewed for changes required by the migration to Git.  Information and commands on this page may no longer be valid and should be used with care. Please see the [[Development/Git|KDE Git hub page]] for more details. }}
Updated version available at the [https://community.kde.org/Infrastructure/Git/Recipes Community wiki].
===GIT/KDE useful recipes===
===Backporting fixes===
Let's say you just fixed a bug in kde-apps and you commited it to the master and git reported it as commit id 0f601b3d28. You want now to get it backported to the latest released version.
When you issue:
<syntaxhighlight lang="bash">git branch -a</syntaxhighlight>
you get
<syntaxhighlight lang="bash">
* master
  remotes/origin/HEAD -> origin/master
The red-colored lines are showing you the branches that are living into the main repository (you must have enabled git colors before this).
You need to backport to the last released version, which lives in the remotes/origin/KDE/4.6:
<syntaxhighlight lang="bash">
git checkout -b KDE/4.6 origin/KDE/4.6
This will get get you on the backport branch. Verify the diff between this old branch and the origin branch where you commited your fix :
<syntaxhighlight lang="bash">
git diff origin <fileYouModified>
To apply your fix, do this:
<syntaxhighlight lang="bash">
git cherry-pick 0f601b3d28
You just applied your fix (well, if you get merging errors, just fix them as usual). See it by yourself:
<syntaxhighlight lang="bash">git log</syntaxhighlight>
Now push your changes:
<syntaxhighlight lang="bash">
git push
Don't forget to get back on the main branch:
<syntaxhighlight lang="bash">git checkout master</syntaxhighlight>

Latest revision as of 12:18, 28 April 2019

Updated version available at the Community wiki.

This page was last edited on 28 April 2019, at 12:18. Content is available under Creative Commons License SA 4.0 unless otherwise noted.