Live data from Hacker News

Exploring an alternative to git-subtree

mos6581.org

11–12 of 12 posts

Re: Exploring an alternative to git-subtree

#11
post #3

Things get even more exciting when you want to push that submodule commit afterwards to fix things, only to find out that someone sneaked in a commit in the meantime! Now you’ll have to create a new commit on the top-level project to point it to your rebased commit, hah! I don't quite understand this one. "Now you’ll have to create a new commit...". At this point, you haven't yet created a top-level project commit at…

I don't quite understand this one. "Now you’ll have to create a new commit...". At this point, you haven't yet created a top-level project commit at all.

That sentence intends to illustrate what can happen when you forget to push your submodule commit before commiting on the top-level repository.

Why was submodule better than just using a single repo and multiple remotes in this case?

I'm not sure what you mean with this.

Or put another way, what did you gain by having separate repos if all the repos branch and come back in exactly the same way.

We used submodules because the code in the submodules was shared with another team.

You want to also branch the submodules so as not to break another branch.

Re: Exploring an alternative to git-subtree

#12

This is better than git-subtree, but it unfortunately still results in an ugly commit history graph. I've actually been working on another alternative to git-subtree: https://github.com/laughinghan/git-subhistory Splitting is the same as git-subtree, but doesn't duplicate commits when merging upstream commits to the library, by inverting split, creating commits in the main project corresponding to the upstream commit…

Serendipitously, I've been working on a new Git command called `git-subrepo` for the last 3 months that deals with all these concerns and more. The command became fully usable about a week ago.

The https://github.com/ingydotnet/git-subrepo addresses all the known concerns of the project owner, project collaborators, and end users. It keeps state in `path/subdir/.gitrepo` which means that git commands like `git mv` just work.

It also has squeaky clean history, which I've documented here: https://github.com/ingydotnet/git-subrepo/blob/master/doc/in...

Feel free to contact me by GitHub, IRC ingy@irc.freenode.net or email ingy@ingy.net.

Post reply on HN