Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony2 project with Git : Best approach?

Tags:

git

symfony

I'm currently moving from symfony 1.4 using SVN to Symfony2 using Git. I am new to Git and have read a lot of documentation since a week but, unfortunately, I am unable to find a way to work as I worked before with SVN. Indeed, I understood that the approach is different between these two SCM.

Let explain how I worked with sf1.4 and SVN. My repository structure was like this :

root    /* Main repository */
  branches
  tags
  trunk
    apps
      backend
      frontend
    cache
    [...]
    lib
      [...]
      vendor
        symfony    /* SVN external to symfony sources */
    log
    plugins
      sfThemePlugin    /* SVN external to sfThemePlugin */
      xxMyPlugin    /* SVN external to a plugin repository I develop */
    test
    web

In this way, I was able to :

  • Load an entire project in my favorite IDE with vendors, plugins and my own plugins
  • Able to update symfony, plugins and other vendors from their respective repositories
  • Work on my own plugins and commit them without switching of project

Now I would like to do the same with a Symfony2 project and Git. The problems are :

  • The Sf2 Git repository contains a 'src' and a 'test' folder in its root so my project repository cannot include the Sf2 sources as I did with sf1.4 without generating conflicts if I add some files in 'src' and/or 'test' to my project or want to update the sf2 sources.
  • I would like my bundles to have their own repositories and be able to work on them, switch of branches, commit and push/pull without having to switch of project, commit and push the bundles source independently and then update my main project submodules.

What would be the best approach to do this ?

like image 230
Fredro Avatar asked Nov 14 '22 00:11

Fredro


1 Answers

I was unclear about if you're already using them, or were just referring to "submodules" in the generic sense, but check out submodules for keeping everything together but being able to push/pull independently.

For your src and test problem, if you want to layer local changes into a folder, the best way is to propagate them through a local branch, as I described here. That question was for temporary debug changes, but the basic principle still applies.

like image 96
Karl Bielefeldt Avatar answered Dec 09 '22 14:12

Karl Bielefeldt