Actions

Difference between revisions of "Working with git and github"

From Joomla! Documentation

(add link to new Eclipse / git doc)
m (What is the Joomla! CMS?: content need reason)
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
=Intro=
 
This document will provide a brief overview of working with the Joomla Platform repository on github.com for people who are interested in making code contributions and using eclipse as an IDE. Much will also apply for people who just want to follow development, but that is much simpler.
 
This document will provide a brief overview of working with the Joomla Platform repository on github.com for people who are interested in making code contributions and using eclipse as an IDE. Much will also apply for people who just want to follow development, but that is much simpler.
  
 
Some preliminary information.
 
Some preliminary information.
  
 
+
=== What is Git? ===
== What is Git? ==
+
 
+
  
 
Git is distributed version control software. Such software (another example is Mercurial while subversion and CVS are non distributed version control systems) allow many people to contribute code to a single project and also allow for well defined tracking of code changes and provide mechanisms for recording commit by commit records of changes.
 
Git is distributed version control software. Such software (another example is Mercurial while subversion and CVS are non distributed version control systems) allow many people to contribute code to a single project and also allow for well defined tracking of code changes and provide mechanisms for recording commit by commit records of changes.
  
 
+
=== What is Github? ===
== What is Github? ==
+
 
+
  
 
Github is a host for git repositories. It is located at [https://github.com github.com]
 
Github is a host for git repositories. It is located at [https://github.com github.com]
  
 +
=== What is the Joomla! CMS? ===
 +
{{page|needs content|article title is generic, a little expansion could make this a real good generic starter overview}}
  
== What is the Joomla! Platform? ==
+
=== What is the Joomla! Platform? ===
 
+
  
 
The Joomla! Platform also known as the Joomla! Framework is the set of libraries that are used to build the Joomla! CMS and other applications.
 
The Joomla! Platform also known as the Joomla! Framework is the set of libraries that are used to build the Joomla! CMS and other applications.
Line 25: Line 23:
 
The platform repository is located at: [https://github.com/joomla/joomla-platform  github.com/joomla/joomla-platform]
 
The platform repository is located at: [https://github.com/joomla/joomla-platform  github.com/joomla/joomla-platform]
  
== First steps: Github account ==
+
=Getting Started=
 
+
=== Setup a Github account ===
 
First, you will need to register at git hub.   
 
First, you will need to register at git hub.   
  
Line 33: Line 31:
 
If you are going to code, you will also want to click on fork. This will give you your own copy of the platform to work with. You'll probably want to follow that too.
 
If you are going to code, you will also want to click on fork. This will give you your own copy of the platform to work with. You'll probably want to follow that too.
  
== Second steps: Install git ==
+
=== Install Git ===
 
+
 
Now you will want to install git on your local workstation. Github provides excellent instructions on how to do this that will detect your operating system. Simply click on the Set Up Git button.
 
Now you will want to install git on your local workstation. Github provides excellent instructions on how to do this that will detect your operating system. Simply click on the Set Up Git button.
  
Line 41: Line 38:
 
You will also need to tell Git your user name and password so that it can connect to your repositories on github.
 
You will also need to tell Git your user name and password so that it can connect to your repositories on github.
  
== Third steps ==
+
=== Methods of Using Git ===
 
+
==== Command Line ====
=== Command Line ===
+
 
If you like using the command line, git by itself provides commands to create a local copy of your fork at github. There are a number of tutorials and reference sites for git including:
 
If you like using the command line, git by itself provides commands to create a local copy of your fork at github. There are a number of tutorials and reference sites for git including:
 
* [http://git-scm.com/documentation  git-scm.com/documentation]
 
* [http://git-scm.com/documentation  git-scm.com/documentation]
Line 49: Line 45:
  
 
Github itself has many documents about how to use git on its help site
 
Github itself has many documents about how to use git on its help site
*[http://help.github.com/ help.github.com/]
+
*[http://help.github.com/ help.github.com]
 
+
=== Eclipse ===
+
  
 +
==== Using Eclipse ====
 
For updated information on working with Eclipse and Git, see [[Working with Git and Eclipse]].
 
For updated information on working with Eclipse and Git, see [[Working with Git and Eclipse]].
Git can also be used with Eclipse, a popular integrated development environment (IDE).
 
 
Setting up Eclipse to work with git and github involves a number of steps.
 
 
Important references are:
 
[http://wiki.eclipse.org/EGit/User_Guide wiki.eclipse.org/EGit/User_Guide]
 
and
 
[http://wiki.eclipse.org/EGit/GitHub/UserGuide wiki.eclipse.org/EGit/GitHub/UserGuide]
 
 
First, you will need to install eGit and Mylyn. Mylyn is probably not really necessary but it will let you access other features of github. Note that Mylyn has dependencies and you will need to install them first (see the user's guide).
 
 
To install eGit from eclipse, go to Help>Eclipse Marketplace. Search for git and click install.
 
 
Follow the instructions to fill in your github account information to identify yourself, defaults and other settings.
 
 
Once installed, if you click File>Import you should see Git listed as an option and projects from Git as a sub option.
 
 
Note the following owes a lot to a number of sites including [http://blog.opsb.co.uk/getting-started-with-git-github-and-eclipse-p http://blog.opsb.co.uk/getting-started-with-git-github-and-eclipse-p].
 
 
One important thing to note before starting is that we will be working with the fork you made in Step 1 (If you didn't make a fork then, do it now). Thus we will not be making a new repository. When reading help materials make sure not to follow instructions to create a new remote repository.
 
 
Your fork on github will have a set of three links (ssh, http, git read-only) . You will need the http link.
 
 
Click File>Import.
 
Choose Projects from Git, click next.
 
On the next screen, click Clone and add your http link. The other fields except your password will autofill. (If you haven't set up your username previously you will need this too).
 
 
Click Next, select master (that is all you will have if this is your first time).
 
Set a directory.
 
Click finish and the files from git will be cloned which means they will be downloaded to your folder.
 
 
Next Eclipse will want to create a project. Do not do it!! Instead, in a way that works for your operating system create a hidden file called .project.
 
 
In the file put:
 
<syntaxhighlight lang="xml">
 
<?xml version="1.0" encoding="UTF-8"?>
 
<projectDescription>
 
<name>joomla-platform</name>
 
<comment></comment>
 
<projects>
 
</projects>
 
<buildSpec>
 
<buildCommand>
 
<name>org.eclipse.wst.validation.validationbuilder</name>
 
<arguments>
 
</arguments>
 
</buildCommand>
 
</buildSpec>
 
<natures>
 
<nature>org.eclipse.php.core.PHPNature</nature>
 
</natures>
 
</projectDescription>
 
</syntaxhighlight>
 
 
But change joomla-platform to the name of your folder.
 
 
Now your folder should appear on the list of projects. Select it and finish.
 
 
You should now have a git local repository.
 
  
 +
=Working on Joomla! Code=
 
== Getting to Work ==
 
== Getting to Work ==
  
Line 139: Line 76:
 
</pre>
 
</pre>
  
 +
=Beyond the Basics=
 
== Further steps ==
 
== Further steps ==
  
Line 144: Line 82:
  
 
To be continued ...
 
To be continued ...
 +
{{page|needs content}}
  
 
== Trouble Shooting ==
 
== Trouble Shooting ==
Line 153: Line 92:
 
* [http://progit.org/book/ Pro Git]
 
* [http://progit.org/book/ Pro Git]
 
* [http://www.ndpsoftware.com/git-cheatsheet.html Git Cheatsheet]
 
* [http://www.ndpsoftware.com/git-cheatsheet.html Git Cheatsheet]
 +
<headertabs/>
 
[[Category: Bug Squad]] [[Category: Development]]
 
[[Category: Bug Squad]] [[Category: Development]]

Revision as of 17:24, 1 March 2013

Contents

Intro

This document will provide a brief overview of working with the Joomla Platform repository on github.com for people who are interested in making code contributions and using eclipse as an IDE. Much will also apply for people who just want to follow development, but that is much simpler.

Some preliminary information.

What is Git?

Git is distributed version control software. Such software (another example is Mercurial while subversion and CVS are non distributed version control systems) allow many people to contribute code to a single project and also allow for well defined tracking of code changes and provide mechanisms for recording commit by commit records of changes.

What is Github?

Github is a host for git repositories. It is located at github.com

What is the Joomla! CMS?

Copyedit.png
This Article Needs Your Help

This article is tagged because it NEEDS CONTENT. You can help the Joomla! Documentation Wiki by contributing to it.
More pages that need help similar to this one are here. NOTE-If you feel the need is satistified, please remove this notice.

Reason: article title is generic, a little expansion could make this a real good generic starter overview


What is the Joomla! Platform?

The Joomla! Platform also known as the Joomla! Framework is the set of libraries that are used to build the Joomla! CMS and other applications.

The platform is managed separately from the CMS and has its own release cycle; each release of the CMS uses one specific version of the platform.

The platform repository is located at: github.com/joomla/joomla-platform

Getting Started

Setup a Github account

First, you will need to register at git hub.

Once registered, you will probably want to go to github.com/joomla/joomla-platform and click follow. Then whenever you log in you will see the latest things that have happened in the repository.

If you are going to code, you will also want to click on fork. This will give you your own copy of the platform to work with. You'll probably want to follow that too.

Install Git

Now you will want to install git on your local workstation. Github provides excellent instructions on how to do this that will detect your operating system. Simply click on the Set Up Git button.

You will need to set up SSH. As it says on the Github instructions " Setting them up is fairly easy, but does involve a number of steps." Some will be specific to your operating system, so follow the instructions at github.

You will also need to tell Git your user name and password so that it can connect to your repositories on github.

Methods of Using Git

Command Line

If you like using the command line, git by itself provides commands to create a local copy of your fork at github. There are a number of tutorials and reference sites for git including:

Github itself has many documents about how to use git on its help site

Using Eclipse

For updated information on working with Eclipse and Git, see Working with Git and Eclipse.

Working on Joomla! Code

Getting to Work

Once you have your repository you are ready to start working on code. Whenever you have some code that you are happy with, you should commit it locally. Note that unless you commit, your local changes will not enter into version control. To commit, you click Team>commit.

Creating patches

The most painless method seems to be the command line as described on the git home page as a quick start "Cloning and Creating a Patch"

$ git clone git://github.com/joomla/joomla-platform.git
$ cd joomla-platform
$ (edit files)
$ git add (files)
$ git commit -m 'Explain what I changed'
$ git format-patch origin/master

It seems also possible to create patches in eclipse eGit

You can also use git-diff to create patches, to create a diff with the latest commit

$ git diff --no-prefix ^HEAD

Beyond the Basics

Further steps

To be continued ...

Copyedit.png
This Article Needs Your Help

This article is tagged because it NEEDS CONTENT. You can help the Joomla! Documentation Wiki by contributing to it.
More pages that need help similar to this one are here. NOTE-If you feel the need is satistified, please remove this notice.


Trouble Shooting

If you get a message about unpacking try adding .git to the end of the remote repository url.

Reference

<headertabs/>