What have you found for these years?

2011-07-08

wonderful git-subtree (dev log)

from: Lin Jen-Shin (godfat)
date: Fri, Jul 8, 2011 at 2:54 AM

[...]

So we gave up git submodule because Heroku didn't support it.
Then we tried git-subtree, and it works so great! Though I feel
it might generate a lot of noisy commits, and I am not sure if this
is avoidable... At any rate, I think this is acceptable trade off.

git subtree works like a complete solution for fake_submodule.
We can resolve conflicts and 3-way merge like usual instead of
patching the patches, which is really painful.

As a consequence, we no longer need to make [...] public,
since everything is inside the repository, just like a normal
repository. We can develop exactly like before, except that
replace fake_submodule with git-subtree. This means, not all
people need to worry about git subtree. We can work as before,
always let me do the synchronizing. Need not worry about
how to use it, though it's very simple to use.

You can install it via `brew install git-subtree` if you're using
Homebrew. Remember to run `brew update` before installing.
The source is located at: https://github.com/apenwarr/git-subtree

You can find the new workflow here:
[...]
I'm not sure whether this would be the final edition, for example,
should we use --squash when doing subtree push and subtree pull?
For now it seems the answer is YES, but let's try more before
jumping to conclusion.

This functionality should definitely be built into official git. I believe
people would like git subtree more than git submodule, which is too
hard to use.

I had a hard time explaining git submodule.... Many people couldn't
understand what did I explain about git submodule. :/ I tried a lot
of analogies, none of them explained clearly.

* * *

Also, Andrew and I had created [...] generator which would
walk through the dependencies and calling all [...] generators
for us. To use it, make sure we're using one of the gems from [...],
and then run:

rails generate [...]

For example, if [...] is used, then this would do something like this:

rails generate [...]
rails generate [...]

for you, just as running `./script/generate [...]` before.
This is very easy to implement:

require 'rails/generators'

class [...]Generator < Rails::Generators::Base
  def call
    Rails::Generators.lookup!
    gens = Rails::Generators.subclasses.select{ |klass|
      klass.name.start_with?('Bb') }
    gens.each(&:start)
  end
end

That's it!

* * *

We haven't created a meta [...] gem, since all we have now is [...]...
It's trivial to do so too, so don't worry about it.

We have both modularity and conveniency at the same time! :p

Thank you Andrew!

0 retries:

Post a Comment

All texts are licensed under CC Attribution 3.0