Development/Git

From KDE TechBase

This is the hub page for all information about the use of Git by KDE.

This page is a work in progress where all new Git material is being organised. Most of these sections will eventually be moved to their own pages. Feel free to add stuff.

External Git Resources

Links to useful external sites about Git

Official Documentation

Git for SVN Users

Tutorials

Cheat Sheets

Git Policies

KDE policies on Git. More generic development policies go elsewhere.

Git Configuration

How to set up Git for use in KDE.

Configuration Levels

Your Git configuration operates at 3 levels:

  • System
  • User
  • Repository

The System Level sets up global Git configuration defaults for every User and Repository on your system. We will ignore these for our purposes as they are usually blank.

The User Level sets up the default configuration for a particular User to apply to all repositories used by that User. Settings made at this level will always override any matching System Level settings. The User Configuration is stored in your ~/.gitconfig file.

The Repository Level sets up the configuration for a particular Repository clone. Settings made at this level will always override any matching User or System Level settings. The Repository Configuration is stored in the repository .git/config file.

The recommended KDE Git Configuration will set some settings at a user level and some at a repository level. You may wish to change the level some settings apply at however as we will assume you only or mostly use Git for developing KDE.

URL Renaming

Instead of having to remember and type in the different full git addresses for pulling and pushing, we recommend you add the following to your Git User Configuration (~/.gitconfig):

[url "git://anongit.kde.org/"]
    insteadOf = kde:
[url "[email protected]:"]
    pushInsteadOf = kde:

RSA Key fingerprint for git.kde.org

c8:45:ba:89:85:11:78:b5:a4:09:d9:31:f6:7f:7c:79

Git Recipes

Brief recipes for common use cases.

Working with remote branches

Remote branches are branches created on the main KDE repository. These may be a stable branch that you need to do bugfixes on, i.e. the 4.6 release, or a feature branch based on master.

git branch --track <local-branch> <remote-branch>
git checkout <local-branch>
git push origin <local-branch>:<remote-branch>

Working with stable branches

For kdelibs, kdepimlibs, kde-runtime, kate, konsole and kde-workspace, the remote stable branches are named as follows:

origin/KDE/4.6

For these modules, to set up a local stable branch to track the remote stable branch:

git branch --track KDE/4.6 origin/KDE/4.6
git checkout KDE/4.6

To then push changes to the remote stable branch:

git push origin KDE/4.6:KDE/4.6

In other projects the remote stable branches are named as follows:

origin/4.6

For these modules, to set up a local stable branch to track the remote stable branch:

git branch --track 4.6 origin/4.6
git checkout 4.6

To then push changes to the remote stable branch:

git push origin 4.6:4.6

Cherry Picking

Cheery picking is a way to copy a single commit from one branch to another.

When cherry picking between stable and unstable branches, use the following form:

git cherry-pick -e -x <original-commit>

Common Options

-e will allow you to edit the commit message to add any extra details and to change the BUG/CCBUG/FIXED-IN messages.

-x will automatically add the original commit number to the end of the commit message to enable better tracing and to simplify merging. Only do this if the original commit was already published in a public repository, e.g. your are forward porting or back porting the patch.

-n will cherry-pick the changes but not commit them to the new branch. This is very use full if you need to do further work on a commit.

Git Tutorials

More in-depth instructions in using Git


Documentation Changes

Existing Pages For Review

Existing KDE pages about Git, SVN, and/or building KDE that need to be revised. When revising pages try to split the generic development and revision control policies separate from Git specific stuff. Do not refer to "the KDE Git Repository" but instead the "KDE Code Repository". Lots of small simple pages that are less daunting to newbies and can be linked to from multiple locations are preferred to massive walls of text.

On community.kde.org:

On techbase.kde.org:

There are also numerous other pages referring to "the KDE SVN/subversion repositories" which should be replaced with the generic "KDE code repositories".

There are also numerous translated pages which will need to be updated once the original pages are completed.

New Page Structure

For Deletion

The following pages can now be deleted: