This article shows you how to use Git and Github to code and submit changes to the Joomla CMS. If you are not familiar with Git, you may with to read the tutorial Git for Testers and Trackers first.
The fist step is to set up the remote and local Git repositories. You do this once. Once it is set up, the normal workflow is:
Each of these steps is explained below. Note that you can use Git from the command line, from and IDE such as Eclipse (with the eGit plugin), or from a stand-alone tool, such as TortoiseGit. Here we will use the command line and, where applicable, show the equivalent command in Eclipse eGit.
Github allows you to create your own copy of any public repository, including the Joomla CMS. This is your personal copy of the repository and is called a "fork". To create a fork of the Joomla CMS:
Note that you can only create one fork of any given repository. However, as we will see, you can create as many branches (versions) of your repository as you like.
At this point, you have your own repository on Github.com. Now you need to create a local repository that is a copy (called a "clone") of the Github repository. To do this:
git clone https://github.com/<your Github user name>/joomla-cms.git .For example, if your Github user name is "joomla-coder", the command would be:
git clone https://github.com/joomla-coder/joomla-cms.git .
You can get the URL for the command above from your repository at Github.com as shown below.
Note that the "." dot just tells Git to put the new repository in the current directory. The system will work for a few minutes while it downloads all of the files. When it is finished, you will have a complete set of Joomla files under version control in the current directory.
Now we have our local repository. This has a remote called "origin" that points to our personal fork of Joomla on Github.
In a project like Joomla, many users are submitting bug fixes and features. These changes are committed to the main Joomla CMS repository frequently. It is up to each coder to keep their personal repositories up to date with these changes. Fortunately, as we will see, this is easy to do.
The last step in the setup is to create a second remote called "upstream" that points to the main Joomla CMS repository. We will use this remote to pull changes that others make to the main Joomla repository so we can keep our personal repositories up to date.
To create a remote called "upstream" that points to the main CMS repository, enter this command:
git remote add upstream https://github.com/joomla-coder/joomla-cms.git
Unknown at this time.
At this point, you have your personal remote repository (created by "forking" the Joomla CMS project) and your personal local repository (created with CLI or Eclipse). Now you are ready to code patches and features.