Trying to get up to speed with a Git workflow and I have some questions
about working with extensions.
If I have a radiant project A that uses someone else’s extensions B, C,
and D. I understand that I can create a repo for radiant project A set
up all the extensions as submodules (if they’re all in git repos).
If, on the other hand, I’m developing extension B, I could set up a
dummy project A (no repo), and set up B, C, and D as independent,
parallel repos. No submodules. With B being the one I’m working on,
managing, branching, etc. of course.
But what if I’m developing extension B along with project A? If you
edit code within a submodule B, there’s no way to send those changes
back to the original B repo (or use branching, or other git tools) on B
is there? Git isn’t really tracking your changes on B is it?
Is there some way to handle this development situation or am I just
going about this wrong?
Is piston or braid an option here and if so, is anyone using it
successfully?
Thanks,
-Chris P.
Like svn:externals, you can maintain a submodule in a project, commit to
it and push it while maintaining the parent project. However, whenever
you’ve changed something in the submodule, it’s necessary to go back up
to the parent project, commit the submodule directory, and possibly do
git submodule init
and git submodule update
(I don’t know if that’s
strictly necessary, but I like to do it to be certain). That will make
sure that the next time your parent project is checked out, it will get
the latest submodule version.
Sean
So, to make sure I understand…
If I have an extension of mine in a submodule of a project, I can
develop within that extension:
* make changes in that copy of the extension (testing its behavior
as part of the project)
* commit those changes to the submodule's repo
* manage branching (gitk, etc) from within that submodule
If so, that helps me a lot. Everything I’d read made it sound like
submodules don’t behave like a working git repo which is why I thought
you couldn’t push changes back to the original – that submodules only
permitted data transfer one-way (from source to your local copy).
-Chris
Chris,
You may want to have a look at the ray extension. It enables you to
manage your extension also as git submodules. I just discovered this
extension and enhanced my fork to accept a ‘remote’ variable either on
the command line or within the bundles extensions.yml (to install a
bunch of extension), so you can add git remotes automatically with the
installation of the extension. There is also a new rake task ray:pull
that pulls all remote sources to the submodule. This comes handy when
you’re developing an extension that you have forked.
Michi
On Oct 17, 2008, at 11:28 PM, Chris P. wrote:
data transfer one-way (from source to your local copy).
develop, commit, and push from the master project (the Radiant
the project’s repo and ‘git submodule update’ as Sean mentioned.
there (apart from the Radiant project), then go back to my project
and update those changes into my submodule?
I guess the question is “is a submodule (the copy checked out into
my project) a full-fledged git repo that you can branch, change, etc
(all from within the project)?”
Yes. Just “cd vendor/extensions/whatever” and do your git stuff there,
commit those changes from there to that repo, then “cd …/…/…” and
commit the altered submodule. I’m no pro with git, but I’m relatively
confident that’ll do it.
-Jim