Live data from Hacker News

Git Subtree merged into mainline git

github.com

31–39 of 39 posts

Re: Git Subtree merged into mainline git

#31
post #2

If you want to know what the git subtree command is, see http://apenwarr.ca/log/?m=200904#30

Additionally useful: Text file explaining the command and usage (from the commit): https://github.com/gitster/git/blob/634392b26275fe5436c0ea13...

Examples are at the bottom.

Re: Git Subtree merged into mainline git

#32
Here's a blog post that illustrates how Git Subtree works in a visual way: http://psionides.eu/2010/02/04/sharing-code-between-projects...

So, to avoid duplicate commits, you'd either have to rebase the main branch or squash the commits before adding it back to the subtree (and lose history)?

Re: Git Subtree merged into mainline git

#34
post #13
post #8

Earlier quoted context omitted.

Ever had an upstream gitsubmodule move or shut down? I can't go back 6 months in my SCM and rebuild exactly what I had because the repo is gone now. This is bad and against the concept of having an SCM in the first place. There is a horrible habit of people forking projects on github just so their submodule stay stable. It's broken.

> There is a horrible habit of people forking > projects on github just so their submodule > stay stable. It's broken. People are forking projects on github in that way because it's a quick, easy, cheap way to create a mirror/hosted copy of the repository they want to use. I don't see how this is an example of how git-submodule is broken. If you want to use someone else's code, that is under someone else's control in…

Sure. Why I explained the work around. Subtree includes the full history of the other project without work-arounds

Re: Git Subtree merged into mainline git

#35
post #7

I've never used git in-the-large, which may be why I don't understand: Why must some other library/module be part of my project? Why not reference and maintain the external lib/mod externally? We've been doing that for decades. It seems a solved problem. Bringing an external library within the fold of your project feels like unnecessary coupling.

For instance because you have componentized your product into different repositories, use different combinations of the components in different projects, but are still actively developing many of them simultaneously on each of those projects. Having to build, deploy and fetch gems (or whatever other method of distribution your language uses) is cumbersome if development is still really active. I don't think you shoul…

"For instance because you have componentized your product into different repositories, use different combinations of the components in different projects, but are still actively developing many of them simultaneously on each of those projects."

Funny, I thought this was the beginning of an argument agreeing with me. :)

Re: Git Subtree merged into mainline git

#36
post #28
post #9

Earlier quoted context omitted.

Dependency control it is a solved problem. Which is why SVN has externals, Hg has hgsubs, and Git has submodules and now subtrees. This isn't a git-in-the-large problem, it's an almost-any-nontrivial-project problem. It only seems unnecessary 'till you've had it and tried to live without it. Bringing other libraries into my project is beneficial because then my build system is able to wrangle those just as easily as…

Sometimes when I'm at work I forget that not all languages have maven.

I really like maven (and run my own repo for my own projects), but it has its own problems in the latter case I described.

Re: Git Subtree merged into mainline git

#37

Earlier quoted context omitted.

> Git submodule is a mess and now a legacy of git. I hear this kind of thing all the time, but I don't understand why. I've never had any problem whatsoever with git submodule. Can you elaborate a bit on what you mean by this?

Off the top of my head: Ever tried removing a submodule? Why is there no git submodule rm? (No, "it's confusing" is not a valid argument.) If the pull fails (say, from the wrong protocol), you end up with a half-baked submodule. Impossible to move, impossible to remove, impossible to update unless you dive into the config. Misspell the folder you wanted the submodule in? That sucks. Go delete it from two separate loc…

Speaking of git submodule rm, here's a basic script I use for that [1], based on Stackoverflow's answer [2].

1. https://github.com/byrongibson/scripts/blob/master/git-rm-su...

2. http://stackoverflow.com/questions/1260748/how-do-i-remove-a...

Re: Git Subtree merged into mainline git

#38
post #13

Earlier quoted context omitted.

> There is a horrible habit of people forking > projects on github just so their submodule > stay stable. It's broken. People are forking projects on github in that way because it's a quick, easy, cheap way to create a mirror/hosted copy of the repository they want to use. I don't see how this is an example of how git-submodule is broken. If you want to use someone else's code, that is under someone else's control in…

Sure. Why I explained the work around. Subtree includes the full history of the other project without work-arounds

subtree also includes the full history of the other project in your project's history unless you squash all of the commits (and if you squash them, then you haven't stored the full history). There might also be licensing reasons for wanting to keep the repositories separate, but not.

Re: Git Subtree merged into mainline git

#39
post #7

I've never used git in-the-large, which may be why I don't understand: Why must some other library/module be part of my project? Why not reference and maintain the external lib/mod externally? We've been doing that for decades. It seems a solved problem. Bringing an external library within the fold of your project feels like unnecessary coupling.

It's important to not only reference an external project (e.g. library) but also to reference a particular version of that library. (e.g. newer versions could remove deprecated methods which you are using, i.e. which weren't deprecated when you wrote your code.)

Different versions of your code could rely on different versions of the library (e.g. you update your code to a newer version of the library.) So which version of the library you rely on also needs to be version-controlled.

Post reply on HN