Istvano
Istvano

Reputation: 982

Right strategy when using git for multiple extension development

I have got through the git related quesions and I have not been able to make up my mind.

I have many extensions that I have developed and I want to move from svn to git to be able to use better branching and organization.

I develop extensions for Magento where you the parts of the extensions are not located under 1 folder but are spread across the folder structure.

My extensions have files in the following folders:

these folders all contain files from other extensions as well.

I want to be able to develop and test the extensions independently. I know I can use this with branch / change or feature which is great.

Although I would like to be able to check them out / extensions which means only those files are pulled which belong to a certain extension.

Can I do the following ?

Would this approach work at all ? Is there any other way that I am not aware of ?

Thanks a lot in advance.

EDITED:

Should I create an EMPTY REPO, then branch the empty repo to as many branches as extension. then I should be able to merge back the code to master, and do development on the individual branches. In this case what happens when after adding things to the master I need a new empty branch for a new extension ? Can I create an empty branch and branch that ? Is that even possible ?

thanks guys, I thing I am getting closer to a good solution.

Upvotes: 2

Views: 690

Answers (4)

user1067235
user1067235

Reputation:

Yes, this can be done and is something I do for my extension development. The way I achieved this is using the following steps:

  1. Create a repo for each extension I develop
  2. Clone 1 repo into my Magento installation
  3. Merge the cloned files into Magento and put the .git file in the root of my Magento. I can now pull/push from this extension
  4. Next, I rename the .git file in the root of Magento .git%s, where %s is a 2 character string representing the extenion.
  5. Next, clone the second extension repo into Magento.
  6. Repeat step 3 to 6 untill all extensions are in Magento

After this, I have the following git files in the root of my Magento install:

  1. .gitwp
  2. .gitbp
  3. .gitwps
  4. .gitas

Now, I can work all my projects at the same time. If for example, I want to push my changes from the WP project, I can run the following commands:

mv .gitwp .git
git push origin master
mv .git .gitwp

Using the above system I can easily work on all of my extensions in the same Magento environment, while keeping separate Repository's.

I hope this helps

Upvotes: 0

Peter O'Callaghan
Peter O'Callaghan

Reputation: 6186

If your modules are completely unrelated to each other I would create them in their own repositories. For testing purposes, create in it's own independent folder a blank install of whichever version of Magento you wish to develop for. Then create symlinks to the 5 folders you mention in the appropriate places within this.

For testing development create a project which includes just the contents of that repository, but since development without the main source is confusing, most IDE's allow you to include code from an additional folder, so add in whichever version of Magento you are developing testing for, so that you can easily reference the code base.

Now you should be able to test as you work, distributing the module can be a simple case of git exporting and zipping the contents. You then have a simple zip file like any other distributed Magento module, sans Magento core files.

I've actually just started working on a phing based build tool to make Magento Extension development easier, (which you can find at https://github.com/pocallaghan/mephing), but it's in it's early stages and currently lacks any documentation.

Upvotes: 0

Aayush Tuladhar
Aayush Tuladhar

Reputation: 91

The answer is pretty straight forward and I guess NomadCoder presented great way to solve the problem . My suggestion would be to make Development Branch and Release Branch which will help to direct workflow. And since merging branches is easy it will help your work flow transparent. Here a list of git codes you might find handy in your case

Git Brushup

Upvotes: 0

idlethread
idlethread

Reputation: 1161

If each extension is independent of the other, you could probably maintain each in a separate branch (instead of it's own repository as you suggest).

e.g. If you developed 3 extensions, you would have four development branches in your git tree:

master
extn1
extn2
extn3

Everytime the magento code changes, you pull it into master and then rebase your three development branches on top of the latest changes in master.

And if you want to test with them all, just create a new test branch and merge master, extn1, extn2 and extn3 into it.

Upvotes: 1

Related Questions