Open main menu

Changes

5,903 bytes removed ,  13:02, 31 March 2020
remove template
The bottom line is this: modern software development may take many "forms", but it usually boils down to [http://nvie.com/posts/a-successful-git-branching-model/ this]. Git enables such a branched workflow. That is why distributed version control in general, and git in particular, is the most widely adopted version control system for software development <ref>https://ianskerrett.wordpress.com/2014/06/23/eclipse-community-survey-2014-results/</ref>
{{Messagebox ||type = normalSee [[Git/hacks]] for example commands
|text = See [[Git/hacks]] for example commands
}}
== Intro to Git ==
git config --global diff.tool meld
git config --global --add color.ui true
# store password in memory for an hour
git config --global credential.helper 'cache --timeout=3600'
 
 
# recent packaged versions of git might be 1.8.3.1 (CentOS 7.4) whereas the current available is 2.15.1
# push.default is unset; its implicit value is changing in
http://nvie.com/posts/a-successful-git-branching-model/
 
== Submodules ==
Using multiple repositories to compose your project. See https://git-scm.com/book/en/v2/Git-Tools-Submodules
 
<source lang="bash">
git init myproject
cd myproject
git submodule add git@github.com:example.com/htdocs.git website
git submodule add https://gerrit.wikimedia.org/r/p/mediawiki/core.git mediawiki
git submodule add https://gitlab.com/Aranad/tools.git odtools
cd mediawiki/
git checkout REL1_31
cd ../
git commit -m 'initial commit'
git diff --submodule
git config --global diff.submodule log
git diff
git config -f .gitmodules submodule.mediawiki.branch REL1_31
git submodule update --remote
git status
git commit -am 'tracking REL1_31 in the mediawiki submodule'
git config status.submodulesummary 1
git log -p --submodule
cd mediawiki/
git submodule update --remote --merge
git config alias.sdiff '!'"git diff && git submodule foreach 'git diff'"
git config alias.spush 'push --recurse-submodules=on-demand'
git config alias.supdate 'submodule update --remote --merge'
</source>
== Tools ==
* http://flavio.castelli.name/2007/09/04/howto_use_git_with_svn/
== Git Repo Hosting ==
It seems everyone uses GitHub these days (~8 million users, 20 million projects). It's not a bad solution, but there are some drawbacks (you might not want Microsoft looking at your private code), and whether you're just looking to host your own project or setup enterprise-wide git hosting, there are other ways to host your projects in Git. Let's take a look at some options below. Also, [[Comparison of git hosting options]] is a detailed analysis prepared by the Peers community in 2016.
 
=== Copyleft ===
<ol>
<li>[https://pagure.io/pagure Pagure] is a forge written in Python. With pagure you can host your project with its documentation, let your users report issues or request enhancements using the ticketing system and build your community of contributors by allowing them to fork your projects and contribute to it via the now-popular pull-request mechanism. Pagure is a [[RedHat]] project, licensed under the GPL v2. Pagure uses gitolite for controlling user access to repositories. At the time of this writing, Pagure is the project {{CompanyName}} prefers. Some notable features:
<ul>
<li>customizations can be done out of tree which makes upgrading fairly painless
<li>entire projects can be easily exported and imported from one instance to another, all by using only git, including issues, pull requests, and their comments because they are stored as git repos - this means for example one could host their project on pagure.io for some time and then migrate everything to their own instance once they decide to self-host - the project can even be mirrored on multiple servers with everything perpetually synchronized by external cron tasks or pagure hooks.
</ul>
<li>[https://codingteam.net/project/codingteam Coding Team] is a forge written in PHP using the AGPL license. <blockquote>CodingTeam is a free (as in freedom) forge written in PHP with a lot of collaborative work and communication tools. This is a free software released under the GNU Affero General Public License version 3. A little bit of history: the project is born in march 2005 but the first public version (0.42) was released in june 2007. The first motivation of this project was to make a good forge for French-speaking users. Now, developers focus on accessibility and ease-of-use (this forge is recognized by many people as one of the only forge to have understandable and intuitive HCI). CodingTeam is available in many languages and the "lightweight but powerful" philosophy now benefits to everybody!</blockquote>
Sadly, the project doesn't seem to have progressed much past the initial support for git and mercurial.
<li>[https://kallithea-scm.org/ Kallithea] is a fork of the Rhode Code project (after they made disturbing changes to their license) maintained by the Software Freedom Conservancy. <blockquote> a member project of Software Freedom Conservancy, is a GPLv3'd, Free Software source code management system that supports two leading version control systems, Mercurial and Git, and has a web interface that is easy to use for users and admins. You can install Kallithea on your own server and host repositories for the version control system of your choice.</blockquote>
<li>[http://gitolite.com/gitolite/index.html gitolite] is similar to '''gitosis''', but adds features; is currently maintained; and used by large installations like Kernel.org and KDE.
<li>[https://github.com/tv42/gitosis Gitosis] was created by [http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way/ Garry Dolley] ([https://github.com/up_the_irons up the irons]) back in 2007, and is now maintained by [http://eagain.net/about/ Tommi Virtanen] ([https://github.com/tv42 Tv]). Gitosis can still work well for small dev groups who want to use key-based auth for their code like I setup at Harvard' IIC. See https://git-scm.com/book/en/v1/Git-on-the-Server-Gitosis
<li>[https://gitorious.org/gitorious/mainline/archive/HEAD.zip?p=gitorious:mainline.git;a=tree Gitorious] code is available, but the AGPL project was bought out by GitLab, and hasn't been developed since 2015
</ol>
 
=== Not Copyleft ===
<ol>
<li>[https://www.phacility.com/phabricator/ Phabricator] is a full forge; and is used by the WMF. However, the code is [https://github.com/phacility/phabricator/blob/master/LICENSE Apache licensed], not GPL.
<li>'''GitHub''' can make it a bit easier for developers who are used to working with svn because they have 'built-in' [https://github.com/blog/1178-collaborating-on-github-with-subversion svn client] support.<ref>Anyone can use <code>git svn</code> and all the other built-in git subversion bridging commands, GitHub simplifies how to do it.</ref> GitHub [https://enterprise.github.com/home Enterprise] can be installed on your own servers. GitHub costs money for private repos.
<li>[https://about.gitlab.com/ '''GitLab'''] is the "popular" alternative to GitHub that comes in "Community", "Enterprise" and "Cloud" versions. They say it's "[https://about.gitlab.com/better-than-github/ better than GitHub]" One nice thing that I note is that they've integrated git-annex for large binary support. This is a nice plus. (I've personally used git-annex as a file backup system -- like DropBox. In my case, it was to make backups of UbuntuOne when that service was discontinued.) You can install GitLab in minutes on your own server. It's costs if you want the [https://about.gitlab.com/features/#compare Enterprise] version.
<li>'''GitBlit''' is "a pure Java git server that just works". It's run by [https://www.linkedin.com/pub/james-moger/8b/3a3/65b James Moger] and scores of other contributors. GitBlit is self-hosted, so you can get a feel for it quickly by looking at the projects own [https://dev.gitblit.com/ source code]. It does have some nice [http://gitblit.com/features.html features]. Wikimedia Ops used [http://gitblit.com/ Gitblit] prior to switching to [https://www.phacility.com/phabricator/ Phabricator].
GitBlit is designed primarily as a tool for small workgroups who want to host centralized repositories. It comes in two options: GO is an integrated single stack solution so you can really get up and running in no time flat; and there is a WAR version (assumes you already have a servlet container like Jetty or Tomcat.) Gitblit requires a Java 7 Runtime Environment (JRE) Gitblit comes with a lot of [http://gitblit.com/features.html features]
<li>[https://gitea.io/en-US/ Gitea] is a community managed fork of Gogs, lightweight code hosting solution written in Go and published under the MIT license. It's self-hosted. The Gogs project is/was controlled by a single author, and the Gitea fork happened in 2016 by several users and contributors who wanted a different project management style: community-driven. Gitea is librejs compatible.
<li>[https://notabug.org/about Notabug] offers free public hosting, and like Gitea, is based on a modified version of Gogs. A Peers community project, it's MIT-licensed and librejs compatible.
</ol>
== Background ==
Only in /var/www/drupal/sites: www.example.org
</pre>
 
== Git Repo Hosting ==
See [[Git repo hosting]]
== Building a Git server ==