CINXE.COM

Git - The Horde Project

<!DOCTYPE html> <html> <head> <title>Git - The Horde Project</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="keywords" content="groupware,webmail,web,application,framework,php,consulting,support,development,library"> <link rel="SHORTCUT ICON" type="image/x-icon" href="https://www.horde.org/images/favicon.ico"> <link href="https://plus.google.com/105569801098474752113" rel="publisher"> <!-- Google Analytics --> <script type="text/javascript"> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-22320801-1', 'auto'); ga('send', 'pageview'); </script> <!-- End Google Analytics --> <link href="https://www.horde-llc.com/horde/static/4b688369a63d07d2.css" rel="stylesheet" type="text/css" /></head> <body> <div class="area"> <div class="inside"> <div class="top"> <a href="/" title="Horde" class="logo"><img src="https://www.horde.org/images/logo.png" alt="Horde"/></a> <ul> <li id="home"><a href="/" title="Home" class="home first">Home</a></li> <li><a href="/apps" title="Applications" class="applications">Applications</a></li> <li><a href="http://wiki.horde.org" title="Wiki" class="wiki">Wiki</a></li> <li><a href="http://demo.horde.org" title="Demo" class="demo">Demo</a></li> <li><a href="/support" title="Support" class="support">Support</a></li> <li><a href="/contact" title="Contact Us" class="contactus last">Contact</a></li> </ul> </div> <div class="podest" id="podest"></div> <div class="content"> <div class="main"> <div class="mainareasplit"> <h2><span>&nbsp;</span><a href="/development">Development</a>&nbsp;&nbsp;&raquo;&nbsp;&nbsp;Git</h2> <ul class="communitynav"> <li><a href="/libraries">Libraries</a></li> <li><a href="/development/contribute">Contribute</a></li> <li><a href="http://git.horde.org">Browse Source</a></li> <li><a href="/development/documentation">Documentation</a></li> <li><a href="/development/git">Git</a></li> <li><a href="/development/cvs">CVS</a></li> <li><a href="/development/modules">Modules</a></li> <li><a href="/development/versions">Versions</a></li> </ul> <div class="section"> <div class="sectionintro"> <p>All development work is done against our <a href="https://github.com/horde/">Git repositories on GitHub</a>.</p> <p>You can use the Horde Git repositories as an anonymous user or as a developer.</p> <p>You can checkout, fork, or install each Git module individually and independently from each other, using standard Git commands and tools. If you want to work with the whole Horde Framework or several Horde applications, it is suggested that you use the <a href="https://github.com/horde/git-tools">Horde Git Tools</a> though. The instructions below focus on these tools.</p> <p>You will need a Git client, if you don't already have one. Information on Git can be found at <a href="https://git-scm.com/">http://git-scm.com/</a>.</p> <p>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 <a href="https://kernel.org/pub/software/scm/git/docs/">here</a>. Additional tips and useful links can be found at <a href="https://gitready.com/">git ready</a> and <a href="https://andyjeffries.co.uk/articles/25-tips-for-intermediate-git-users"> 25 Tips for Intermediate Git Users</a>.</p> </div> <h2><span>&nbsp;</span>Horde Git Tools</h2> <h3>Getting The Source Code</h3> <p>Use <a href="https://github.com/horde/git-tools/blob/master/README.md">these instructions</a> to install the Horde Git Tools. Make sure to configure the tools correctly for your needs, and read the documentation in the configuration file.</p> <p>To clone the repositories, use the following command:</p> <pre class="brush:bash">horde-git-tools git clone</pre> <p>To update the repositories, use this command:</p> <pre class="brush:bash">horde-git-tools git pull</pre> <h3>Making Development Repos Web-Accessible</h3> <p>To create a web-accessible development installation, use the following command:</p> <pre class="brush:bash">horde-git-tools dev install</pre> <p>Running that script will symlink the base horde package into the web-accessible directory you specified in <tt>git-tools/config/conf.php</tt>, 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 <tt>dev install</tt> script is run.</p> <p>Full directory paths will be needed in <tt>horde-git/base/config/registry.php</tt> due to the symlinks. The easiest way to setup full paths is to set the <tt>$app_fileroot</tt> parameter in this file (or more appropriately, registry.local.php).</p> <p>Note that unlike a PEAR or Composer install, the <tt>Autoloader_Cache</tt> package will be enabled by default. If you attempt to use Horde or load the test.php page before all dependencies are installed, you will have to purge the autoloader cache.</p> <p>You can now follow the procedures in the normal <a href="/apps/horde/docs/INSTALL">INSTALL</a> document to complete the configuration and database creation.</p> <p>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:</p> <pre class="brush:bash">./base/bin/horde-db-migrate [application_name [up|down]]</pre> <p>If installing the framework libraries directly via PEAR, i.e. not with with the Horde Git Tools, 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:</p> <pre class="brush:bash"> pear run-scripts horde/Horde_Role </pre> <h3 id="patch">Creating Patches</h3> <p>Please use the <a href="https://help.github.com/articles/about-pull-requests/">Pull Request</a> feature on GitHub to submit patches.</p> <h2><span>&nbsp;</span>Developer Git</h2> <p>Write access to the Git repositories as a Horde developer is only available over SSH. You will want to create an SSH key, and you will also need to create an account on GitHub. The following needs to be done:</p> <ol> <li>Create a GitHub account.</li> <li><a href="https://help.github.com/articles/connecting-to-github-with-ssh/">Setup your SSH public key</a>.</li> <li>Join the Horde organization on GitHub (send e-mail to <a href="mailto:core@horde.org">core@horde.org</a>).</li> </ol> <h3>Getting The Source Code</h3> <p>Follow the instruction above to install the Horde Git Tools, but create the configuration file from <tt>config/conf.php.dev.dist</tt> instead of <tt>config/conf.php.dist</tt>. Then continue with making the repositories web-accessible as described above.</p> <h3>Updating repositories</h3> <p>To update your local repositories, <span style="color:red">you MUST rebase the changes on top of your local repo copy</span> if using Git manually, i.e. without using the Horde Git Tools. <span style="color:red">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.</span></p> <p>To update/rebase the changes, you can use the following command that already rebases automatically, and adds a helpful Git <tt>get</tt> alias to update your local repositories while seeing changed files and avoiding conflicts.:</p> <pre class="brush:bash">horde-git-tools git pull</pre> <p>For more information on rebasing, and the commands needed if conflicts are detected during the rebase/merge, see: <a href="https://kernel.org/pub/software/scm/git/docs/user-manual.html#using-git-rebase">http://www.kernel.org/pub/software/scm/git/docs/user-manual.html#using-git-rebase</a> and <a href="https://jbowes.dangerouslyinc.com/2007/01/26/git-rebase-keeping-your-branches-current/">http://jbowes.dangerouslyinc.com/2007/01/26/git-rebase-keeping-your-branches-current/</a>.</p> <h3 id="createcommit">Creating commits</h3> <p>First, you should make sure your contact information is correct. The easiest way to do so is to issue the following commands:</p> <pre class="brush:bash"> git config user.name "FirstName LastName" git config user.email "user@example.com" </pre> <p>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:</p> <pre class="brush:bash"> git add filename [filename2] [filename3...] git commit </pre> <p><tt><a href="https://kernel.org/pub/software/scm/git/docs/git-add.html">git add</a></tt> has many powerful tools to indicate what files or portions of a file you want to commit: the <tt>-i</tt> option (interactive mode), and <tt>-p</tt> option (patch mode) are good examples. Read the man page for further information on these options (and others).</p> <p>You can also list the files to be committed on the command line to commit:</p> <pre class="brush:bash">git commit [filename1] [filename2] ... [filenameX]</pre> <p>If you want to commit all modified files, you can use the following shortcut command:</p> <pre class="brush:bash">git commit -a</pre> <p>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:</p> <pre class="brush:bash">git commit -a -m "[commit message]"</pre> <p>The Horde Git Tools allow to do Git commits on all or several repositories at once. Check its documentation for details.</p> <h3 id="createcommit">Committing with horde-components</h3> <p><a href="https://github.com/horde/components">horde-components</a> is a command line tool to help with all kind of developer tasks. To get the full help and all available actions, run:</p> <pre class="brush:bash">horde-components help</pre> <p>When using the <tt>changed --commit</tt> option to update the changelogs, two separate commits are created. The first one only contains the changes to <tt>changelog.yml</tt> (and any file added earlier to the commit with <tt>git add</tt>, which is the same across all branches. Thus you can easily <tt>cherry-pick</tt> this commit from a different branch. The second commit with the same commit message contains changes to the <tt>package.xml</tt> and <tt>CHANGES</tt> files that may differ between branches and should <strong>not</strong> be cherry-picked. To update those files in the other branch, just run <tt>horde-components changed</tt> without any further arguments again, after cherry-picking the changes to <tt>changelog.yml</tt>. Such a workflow may look like:</p> <pre class="brush:bash"> $ git checkout master $ git add changed_file1 directory/changed_file2 $ horde-components changed --commit "[xyz] Fix this bug." [ OK ] Added new note to version 1.2.3 of /horde/Component/doc/changelog.yml. [ OK ] Updated /horde/Component/package.xml. [ OK ] Updated /horde/Component/doc/Horde/Yaml/CHANGES. [master 08c1c38] [xyz] Fix this bug. 3 files changed, 4 insertions(+) [master 409eac9] [xyz] Fix this bug. 2 files changed, 3 insertions(+) $ git checkout FRAMEWORK_5_2 $ git cp 08c1c38 [FRAMEWORK_5_2 cc95a99] [xyz] Fix this bug. Date: Mon Oct 30 21:54:24 2017 +0100 3 file changed, 4 insertions(+) $ horde-components changed [ OK ] Updated /horde/Component/package.xml. [ OK ] Updated /horde/Component/doc/Horde/Yaml/CHANGES. </pre> <h3>Pushing commits</h3> <p>Once you finish with your local commits and want to push them to the master repository, use the following command:</p> <pre class="brush:bash">git push</pre> <p>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: <pre class="brush:bash">git config push.default matching</pre> <p>Again, using Horde Git Tools will help to push on several repositories at once.</p> <h3>Stashing</h3> <p>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.</p> <p>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: <tt><a href="https://kernel.org/pub/software/scm/git/docs/git-stash.html">stash</a></tt>. To stash all work-in-progress on the current tree, use:</p> <pre class="brush:bash">git stash</pre> <p>When you need to pull the changes back, use:</p> <pre class="brush:bash">git stash apply</pre> <p>Stash has many more features that won't be explained here - check the documentation (e.g. working with multiple stashes, popping a stash).</p> <h3>Combining commits</h3> <p>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:</p> <pre class="brush:bash"> # origin means edit all commits applied on top of the last pull # from the central repository. git rebase -i origin </pre> <p>Use the 'squash' option to combine multiple commits. Instructions on the edit screen explain the various other features.</p> <h3>Creating/Managing remote branches</h3> <p>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:</p> <pre class="brush:bash">git push -u origin [localbranch]</pre> <p>Now all users can track this branch by issuing this command:</p> <pre class="brush:bash">git checkout -t origin/[remote branch name]</pre> <p>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:</p> <pre class="brush:bash"> git checkout [topic] git merge master # resolve conflicts git pull --rebase git push </pre> <p>During a long-lived branch, you will find yourself having to resolve the same conflicts over and over again. The git tool <em>git-rerere</em> is designed to help alleviate this issue. Once it is enabled, it will <strong>automatically</strong> 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:</p> <pre class="brush:bash"> git config --global rerere.enabled 1 </pre> <p>To delete the remote branch, issue this command:</p> <pre class="brush:bash">git push origin :[branchname]</pre> <p>To remove stale remote branches from your branch list, issue this command:</p> <pre class="brush:bash">git remote prune origin</pre> </div> </div> <div class="rightcol" style="background: none;"> <div id="toc" style="display:none"> <h2>Page Contents</h2> </div> <div> <h2>Support us!</h2> <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <div style="text-align:center;height:40px;"> <input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="hosted_button_id" value="DWV8RS3BHMVC2"> <input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_donate_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online!"> <img alt="" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"> </div> </form> <p class="wishlist"> <a href="/community/team">Buy a present for our developers</a> </p> <h2>Sponsors</h2> <ul class="ads"> <li><a href="https://hub.org/?ri=765"><img src="https://www.horde.org/images/hub.png" alt="Hub.Org"></a></li> <li><a href="https://b1-systems.de/"><img src="https://www.horde.org/images/b1systems.jpg" alt="B1 Systems"></a></li> </ul> <p class="thanks"> <a href="/thanks">"Thanks!" to all our other sponsors</a> </p> <h2>More</h2> <iframe src="//www.facebook.com/plugins/like.php?app_id=132513070157462&amp;href=http%3A%2F%2Fwww.facebook.com%2Fpages%2FHorde-LLC%2F192707224109487&amp;send=false&amp;layout=button_count&amp;width=450&amp;show_faces=true&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:120px; height:21px;"></iframe> <a href="http://twitter.com/hordeproject" class="twitter-follow-button" data-show-count="false">Follow @hordeproject</a> <script src="//platform.twitter.com/widgets.js" type="text/javascript"></script> <p> <a href="/logos" class="logos">Logos</a> </p> <h2>Shops</h2> <span style="text-align:center;width:121px;float:left;">European Store<a class="boxl" href="/shop/eu"> <img src="https://www.horde.org/images/store-eu.png" alt="EU Store"> </a></span> <span style="text-align:center;width:121px;float:left;">US Store<a class="boxl" href="/shop/us"> <img src="https://www.horde.org/images/store-us.jpg" alt="US Store"> </a></span> <h2>Status</h2> <div class="status"> <a href="http://status.horde.org"> <span id="status-check">Checking...</span> <span id="status-up" style="display:none"><img src="https://www.horde.org/images/up.png"> All Systems Up</span> <span id="status-down" style="display:none"><img src="https://www.horde.org/images/down.png"> <span id="status-name"></span> is down</span> </a> </div> </div> </div> <div class="clear"></div> </div> </div> <div class="footer"> <div class="section"> <div class="add-nav"> <h3>Site Navigation</h3> <ul> <li><a href="/" title="Home">Home</a></li> <li><a href="/community" title="Community">Community</a></li> <li><a href="/development" title="Development">Development</a></li> <li><a href="/services" title="Services">Services</a></li> <li><a href="/apps" title="Applications">Applications</a></li> <li><a href="http://wiki.horde.org" title="Wiki">Wiki</a></li> <li><a href="http://demo.horde.org" title="Demo">Demo</a></li> <li><a href="/support" title="Support">Support</a></li> <li><a href="http://status.horde.org" title="System Status">Status</a></li> <li><a href="/contact" title="Contact Us">Contact Us</a></li> </ul> </div> <div class="follow-us"> <h3>Follow us</h3> <ul> <li><a href="http://www.twitter.com/hordeproject" class="twitter">Twitter</a></li> <li><a href="http://www.facebook.com/hordeproject" class="facebook">Facebook</a></li> <li><a href="http://github.com/horde" class="github">GitHub</a></li> <li><a href="https://www.ohloh.net/p/horde" class="ohloh">Ohloh</a></li> </ul> </div> <div class="contact-info"> <h3>Quick Contact</h3> <dl class="h-card vcard"> <dt>Email:</dt> <dd><a href="mailto:info@horde.org" class="u-email email">info@horde.org</a></dd> <dt>Postal Address:</dt> <dd> <span class="p-name fn">Horde LLC</span><br> <span class="h-adr adr"> <span class="p-street-address street-address"> 510 E Center St<br> </span><br> <span class="p-locality locality">Clayton</span>, <span class="p-region region">NJ</span><br> <span class="p-postal-code postal-code">08312</span><br> <span class="p-country-name country-name">United States</span> </span> </dd> <dt>Phone:</dt> <dd> <a href="tel:+1.404.400.1661" class="p-tel tel">+1.404.400.1661</a> (US)<br> <a href="tel:+49.521.4469.8995" class="p-tel tel">+49.521.4469.8995</a> (DE) </dd> </dl> </div> <div class="testimonials"> <h3>Testimonials</h3> <p class="what">&quot;Horde 3 beats the competitors already, and Horde 4 looks to beat them hands down.&quot;</p> <p class="who">Arthur P. Meiners</p> </div> <div class="clear"></div> </div> </div> </div> </div> <script type="text/javascript" src="https://www.horde-llc.com/horde/static/2c71f9518e97fff4.js"></script><script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script><script type="text/javascript">//<![CDATA[ $(function(){SyntaxHighlighter.autoloader( 'applescript /horde/js/syntaxhighlighter/scripts/shBrushAppleScript.js', 'actionscript3 as3 /horde/js/syntaxhighlighter/scripts/shBrushAS3.js', 'bash shell /horde/js/syntaxhighlighter/scripts/shBrushBash.js', 'coldfusion cf /horde/js/syntaxhighlighter/scripts/shBrushColdFusion.js', 'cpp c /horde/js/syntaxhighlighter/scripts/shBrushCpp.js', 'c# c-sharp csharp /horde/js/syntaxhighlighter/scripts/shBrushCSharp.js', 'css /horde/js/syntaxhighlighter/scripts/shBrushCss.js', 'delphi pascal /horde/js/syntaxhighlighter/scripts/shBrushDelphi.js', 'diff patch pas /horde/js/syntaxhighlighter/scripts/shBrushDiff.js', 'erl erlang /horde/js/syntaxhighlighter/scripts/shBrushErlang.js', 'groovy /horde/js/syntaxhighlighter/scripts/shBrushGroovy.js', 'java /horde/js/syntaxhighlighter/scripts/shBrushJava.js', 'jfx javafx /horde/js/syntaxhighlighter/scripts/shBrushJavaFX.js', 'js jscript javascript /horde/js/syntaxhighlighter/scripts/shBrushJScript.js', 'perl pl /horde/js/syntaxhighlighter/scripts/shBrushPerl.js', 'php /horde/js/syntaxhighlighter/scripts/shBrushPhp.js', 'text plain /horde/js/syntaxhighlighter/scripts/shBrushPlain.js', 'py python /horde/js/syntaxhighlighter/scripts/shBrushPython.js', 'ruby rails ror rb /horde/js/syntaxhighlighter/scripts/shBrushRuby.js', 'sass scss /horde/js/syntaxhighlighter/scripts/shBrushSass.js', 'scala /horde/js/syntaxhighlighter/scripts/shBrushScala.js', 'sql /horde/js/syntaxhighlighter/scripts/shBrushSql.js', 'vb vbnet /horde/js/syntaxhighlighter/scripts/shBrushVb.js', 'xml xhtml xslt html /horde/js/syntaxhighlighter/scripts/shBrushXml.js' );;SyntaxHighlighter.defaults['toolbar'] = false;SyntaxHighlighter.all();(function() { $.ajax({ dataType: "jsonp", url: "https://app.statuscake.com/Workfloor/PublicReportHandler.php?PublicID=jiTk8BseRI&callback=statusUpdate", success: statusUpdate }); function statusUpdate(data) { var down = false; if (!data || !data.TestData) { return; } $(data.TestData).each(function(id, server) { if (server.Status != "Up") { down = server.Name; return false; } }); $("#status-check").hide(); if (down) { $("#status-name").text(down); $("#status-down").show(); } else { $("#status-up").show(); } } })();}); //]]></script> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10