When you want to add your commits to the local branch, first update your local to the current remote state, then push your commits:

+

When you want to add your commits to the remote branch, first update your local to the current remote state, then push your commits:

git pull --rebase

git pull --rebase

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

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

Line 34:

Line 34:

=== Working with stable branches ===

=== Working with stable branches ===

−

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

+

The remote stable branches are named as follows:

origin/KDE/4.6

origin/KDE/4.6

−

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

+

To set up a local stable branch to track the remote stable branch:

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

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

Line 46:

Line 46:

git push origin KDE/4.6:KDE/4.6

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

=== Creating / Deleting Remote Branches ===

=== Creating / Deleting Remote Branches ===

Line 82:

Line 69:

=== Cherry Picking ===

=== Cherry Picking ===

−

Cherry picking is a way to copy a single commit from any local or remote branch to your current local branch.

+

Cherry picking is a way to copy a single commit from any local or remote branch to your current local branch. You can even add ''any'' remote repository you want to your local clone to cherry-pick from.

−

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

+

git cherry-pick <original-commit>

+

+

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

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

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

−

Note you can add ''any'' remote repository to your local clone if cherry-pick from.

+

Common Options:

−

+

−

;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.

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

Line 108:

Line 95:

where <parent-branch> is the branch you want to rebase onto. This is usually the branch that you based the original local branch off or are remotely tracking, but can be any branch you want.

where <parent-branch> is the branch you want to rebase onto. This is usually the branch that you based the original local branch off or are remotely tracking, but can be any branch you want.

−

To work with just the last x commits you made to a branch:

+

To work with just the last n commits you made to a branch:

−

git rebase -i HEAD^x

+

git rebase -i HEAD^n

HEAD^ is the terminology for saying "commit prior to head". HEAD~ works too. HEAD^^ would indicate 2 commits back, and so forth.

HEAD^ is the terminology for saying "commit prior to head". HEAD~ works too. HEAD^^ would indicate 2 commits back, and so forth.

Cherry picking is a way to copy a single commit from any local or remote branch to your current local branch. You can even add any remote repository you want to your local clone to cherry-pick from.

git cherry-pick <original-commit>

When cherry picking between stable and unstable branches, always 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 useful if you need to do further work on a commit.

If you have changes you don't wish to commit but don't want to lose either while you do something else, you can temporarily 'stash' the changes away. This could be some frequently used debug code,or just some work in progress you need to move to another branch without committing. If the code is just WIP for the current branch we recommend using an interim commit instead.

The stash is a temporary store that holds a stack of uncommitted changes at a repository level. Commands given below work by default with the stash at the top of the stack, or you can optionally provide the stack reference.