Development  »  Git

All new development work should be done against current git code. The master branch is considered the mainline, authoritative branch that will eventually become the next release.

You can use the Horde Git repository as an anonymous user or as a developer.

You will need a Git client, if you don't already have one. Information on Git can be found at

These command lines should be the bare-bones needed to get you started with Horde and Git; this is not a Git tutorial, however. The standard Git documentation is available here. Additional tips and useful links can be found at git ready and 25 Tips for Intermediate Git Users.

Available Repositories

 Anonymous Git

Anonymous Git access is available via GitHub using the git:// protocol.

To clone a repository, use the following command:

git clone --depth 1 git://[REPO]

where REPO is one of the available repositories listed above. The --depth 1 option creates a shallow clone rather than downloading the whole repository; this saves significant storage space on your local machine and requires less network bandwidth during the initial transfer. The disadvantage is that the full repository history will not be available on your local machine, you cannot clone or fetch from it, nor push from nor into it (none of these activities are generally useful for anonymous repositories anyway). If you do want the full repository, simply omit --depth 1.

To update the repository, enter the repository directory and use this command:

git pull

Making Development Repos Web-Accessible

Make sure you have cloned the horde repo. Once initialized, creating a web-accessible development installation can be done simply by running the install_dev PHP script located at horde-git/framework/bin. To properly run this script, the Horde_Role package must be installed and a local copy of install_dev.conf must be created on your system, with the variables inside that file edited as necessary to apply to your system.

For example:

        pear channel-discover
        pear install horde/horde_role
        cd /path/to/horde-git/framework/bin
        cp install_dev.conf.dist install_dev.conf
        vi install_dev.conf (replace vi with your favorite editing tool)

Running that script will symlink the entire horde package into the web-accessible directory you specified in install_dev.conf, symlink all other Horde applications within that directory, and will properly set up the necessary include/horde path definitions. Note that all edits should take place within the repository, as the web-accessible directory will be deleted every time the install_dev script is run.

Full directory paths will be needed in horde-git/horde/config/registry.php due to the symlinks. The easiest way to setup full paths is to set the $app_fileroot parameter in this file.

Note that unlike a PEAR install, the Autoloader_Cache package will be enabled by default. If you attempt to use Horde or load the test.php page before all PEAR dependencies are installed, you will have to purge the autoloader cache.

You can now follow the procedures in the normal INSTALL document to complete the configuration and database creation.

If, after you have configured Horde, you wish you can manually run the database migrations, you can run these from the checkout directory as so:

./horde/bin/horde-db-migrate [application_name [up|down]]

If installing the framework libraries directly via PEAR, i.e. not with with install_dev, you will need to define your horde application directory (i.e. the filesystem directory where the Horde application is installed and accessible to a browser) in your PEAR config. This can be done with the horde/Role package previously installed on your system via:

        pear run-scripts horde/Horde_Role

Creating Patches

To submit patches, first make the changes in your local repository. You will need to commit these changes locally. After committing, use the following command:

git format-patch -M -B origin

This command creates a separate patch file for each commit that exists locally on your machine but does not exist in the master Horde branch (origin). These patch files will be located in your local directory.

 Developer Git

Access to the live Git repository is only available over SSH. You will want to create an SSH key and use that with your account on to avoid having to enter your password on every pull/push.

You will also need to create an account on GitHub as the master repo will be mirrored to GitHub every time a commit is pushed. The following needs to be done:

  1. Create a GitHub account.
  2. Setup your SSH public key. This SSH key must exist in your account.
  3. Make sure the github host key is stored in your account.
  4. Join the Horde organization on GitHub (send e-mail to

Cloning repository

To clone a repository, use this command:

git clone ssh://[REPO]

where REPO is one of the available repositories listed above.

This will create a REPO directory in your current directory. Once completed, an up to date copy of the master Git repository will be available on your system. You must use the SSH protocol rather than the git protocol because the Horde Git repository only supports pushing commits through SSH. (Since Git will automatically use the protocol used to clone the repository for all future push/pull operations, it is easiest to set your local repository up correctly from the beginning.)

Updating repository

To update your local repository, you MUST rebase the changes on top of your local repo copy. Failure to do so will result in useless, annoying commit merge messages both added to the master repository and sent in the commit e-mails.

To update/rebase the changes, you can use the following command:

git pull --rebase

Better still, to prevent an unnecessary merge, you can configure git pull to always rebase when pulling for a particular repo by using the following command:

git config branch.[reponame].rebase true

One disadvantage of git pull is that (as of Git v1.6.1.1) it does not indicate which files are updated. To see a list of files that are updated, you should run these two commands instead:

        git fetch
        git rebase -v origin

A helpful alias for

to update your local repository while seeing changed files and avoiding conflicts is:

            get = !BRANCH=$(git branch -vv | grep ^\\* | sed -r 's/^[^[]+\\[([^]:]+).+$/\\1/') &&
                git fetch &&
                ( git rebase -v $BRANCH ||
                    ( git stash &&
                        ( git rebase -v $BRANCH ||
                          echo "WARNING: Run 'git stash pop' manually!" ) &&
                      git stash pop ) )

For more information on rebasing, and the commands needed if conflicts are detected during the rebase/merge, see: and

Creating commits

First, you should make sure your contact information is correct. The easiest way to do so is to issue the following commands:

        git config "FirstName LastName"
        git config ""

Go ahead and hack away. When finished, commit the files to your local repo. There are several ways to do this. To add specific files to a commit, use the following commands:

        git add filename [filename2] [filename3...]
        git commit

git add has many powerful tools to indicate what files or portions of a file you want to commit: the -i option (interactive mode), and -p option (patch mode) are good examples. Read the man page for further information on these options (and others).

You can also list the files to be committed on the command line to commit:

git commit [filename1] [filename2] ... [filenameX]

If you want to commit all modified files, you can use the following shortcut command:

git commit -a

If you want to commit all modified files, and want a shortcut to also specify the commit message on the command line, use the following command:

git commit -a -m "[commit message]"

Pushing commits

Once you finish with your local commits and want to push them to the master repository, use the following command:

git push

When pushing, it is most likely the desired action to ONLY push changes to branches that are currently being tracked on the master server. This is the default git behavior, but the following config verifies that the setting is configured properly:

git config push.default matching


Say you are working in a git tree and have previously made some local commits. You then started working on other code and modified several other files. However, you then decide you want to push the previously made commits to the central repository (e.g. those commits fix a critical bug). However, git will not let you push your commits because your tree is not clean.

In the absence of originally using a branch to do the newer hacking, you can easily create a temporary branch, move the work-in-progress to the temporary branch, push your commits to the server, and then re-apply your work-in-progress to the current branch. Git has a wonderful built-in command that will do all this work for you: stash. To stash all work-in-progress on the current tree, use:

git stash

When you need to pull the changes back, use:

git stash apply

Stash has many more features that won't be explained here - check the documentation (e.g. working with multiple stashes, popping a stash).

Combining commits

It may often happen that you have many local commits that you want to push to the central repository. It may often be that many of these changes are similar (i.e. nits/doc cleanup/whitespace) or that some of the commits fixed things caused by a previous local, non-pushed, commit. In this case, it may be better to clean up the commit list to make the ultimate project history and commit notification e-mails look nicer. Git provides an easy way to manipulate your local commits:

        # origin means edit all commits applied on top of the last pull
        # from the central repository.
        git rebase -i origin

Use the 'squash' option to combine multiple commits. Instructions on the edit screen explain the various other features.

Creating/Managing remote branches

It may be useful to share work on a local branch with other developers. For example, a large change that might not yet be ready for primetime, but could benefit for some eyeballs, might be useful to share on a branch rather than the master repo. To create a branch on the master Horde repository, and have your existing topic branch track the remove branch, use the following command:

git push -u origin [localbranch]

Now all users can track this branch by issuing this command:

git checkout -t origin/[remote branch name]

You should keep the topic branch up to date with the main branch during development so that your topic branch only contains the changes related to the work being done in the branch:

        git checkout [topic]
        git merge master
        # resolve conflicts
        git pull --rebase
        git push

During a long-lived branch, you will find yourself having to resolve the same conflicts over and over again. The git tool git-rerere is designed to help alleviate this issue. Once it is enabled, it will automatically take note of each conflict, and it's eventual resolution. Next time git comes across the exact same conflict, it will know on it's own how to resolve it. To use this feature you must explicitly enable it:

            git config --global rerere.enabled 1

To delete the remote branch, issue this command:

git push origin :[branchname]

To remove stale remote branches from your branch list, issue this command:

git remote prune origin

Featured At

Featured at:
The FreeBSD Project
Server Fault
Fedora Project Homepage
Home - The Chronicle of Higher Education
tripwire magazine — handpicked goodies for Web Developers and Designers
handpicked goodies for Web Developers and Designers Free Programmers' Resources, Free Webmasters' Resources, Free Security Resources
Free programmers' resources, webmaster resources and internet software. Free Compilers, Libraries, Tools, CGI, PHP, JavaScript, Online timers, etc.
A new welcome to Yahoo. The new Yahoo experience makes it easier to discover the news and information that you care about most. It's the web ordered for you.
hide | The source for Linux information - For the community, by the community, is the central source for Linux information, software, documentation, how-tos and answers across the server, desktop/netbook, mobile, and embedded areas.
Welcome to Freecode – Freecode
Freecode maintains the Web's largest index of Linux, Unix and cross-platform software, as well as mobile applications.

Support us!


"Thanks!" to all our other sponsors


The Horde Project @hordeuser No, because such features are not possible via POP3.
5 months ago     

hordeuser @hordeproject does IMP support search/filter/sent items for POP3?
5 months ago     

ICTConsultant Download installers and virtual machines or run your own Horde Groupware Webmail server in the cloud.
5 months ago     

365webhost247 Stored XSS in FOG Image deployment system - FD - Vulnerability title: Multiple Stored ... -
5 months ago     

The Horde Project @ThijsRoumen Probably not, but again: please talk to your provider.
5 months ago     

Powered by Podnova twitter




European Store US Store CafePress