-
Book Overview & Buying
-
Table Of Contents
Magento Extensions Development
By :
Once the project has begun, it may be a good thing to take care of code revision and eventually collaboration with other developers.
Git is a distributed revision control system developed by Linus Torvalds in 2005, initially for Linux kernel development. It has begun to replace the Subversion (SVN) system in a lot of companies, thanks to its full-fledged repository and independence from network access and a distant server.
As soon as you start to work with other people and developers, the repository must be always available on the Internet. You have two choices to do this: the first is to create a Git repository on your own server (a private server in your organization, or a rented dedicated server), and the second is to use a service that provides a repository for you. In this recipe, we will register our code on Bitbucket.
GitHub and Sourceforge provide the same services, but Bitbucket offers more free services and is fully integrated with other Atlassian services such as Hipchat or Jira. It is up to you to make your choice according to your needs and environments.
Perform the following steps for Bitbucket registration:


Check This is a private repository if you want to hide your repository from the general public, so that only selected people can see it.


sudo apt-get install git
In the following step, we will commit our code to a new repository, and then we will push the repository to Bitbucket:
git init
git status
.gitignore file in the root of the repository and add the following content to it:#Git ignore for extensions writing /app/code/Magento/* /dev/tests/ /lib/ [...]
The source code can be found in the by-chapter branch of the Git repository, in the Chapter1 folder.
.gitignore file is taken into account by running git status again:git status

.gitignore is taken into account by Git.What happened? In fact, in a Magento project, especially with Magento CE, the source files are always available online and are the same for all. That's why you can presume that each of your collaborators first, and every client next, will run Magento. This is your code, it is unique and important, and that's why your code is the only thing to keep in your repository. Note for later: if you need to add another folder in your repository, just remove the corresponding ignore line.
.gitignore file:git add .gitignore git commit .gitignore -m "Ignoring all resources files"
git add <folder | filename>:git -f add app/code/Blackbird/
Note the -f option, to force Git to add the file even if it is stored in an ignored folder. If you don't use this option, Git will inform you that it can't add the file.
git commit -m "Adding the first extension files"
git remote add originhttps://[email protected]/blackbirdagency/ticket-blaster.git
This line is to modify your repository configuration.
git push -u origin master
You will find your files by clicking on your repository name on https://bitbucket.org/, proving that the files have been sent and are available for other users.
Take note not to send useless files.
When you are creating an extension, the people who install your code will already have a Magento instance. It is very important to share only the extension files and not Magento and customizable files, which are already modified or installed by your client.
That's why we have chosen to ignore almost all files by default, and to force a git add with the -f option when the file we need to share is placed in an ignored folder.
There are others Git storage services online, such as https://github.com/ or https://sourceforge.net/, which offer different storage spaces and different public/private repo policies.
You can create your own private Git server too, which can be dedicated to your company or organization.
Change the font size
Change margin width
Change background colour