Search code examples
git-subtreelibgit2libgit2sharp

Is it possible to use subtree commands in LibGit2?


Is subtree functionality implemented in LibGit2? If not, is it planned?

For example: git subtree pull --prefix=SharedStuff repo2 master

I currently have two repositories, where my main repo has a subtree that pulls and pushes from the second repo. I'd like to sync the two repositories daily using a job built from LibGit2. The documentation only mentioned submodules, so I'm wondering if there is a work around for subtrees.

I realize subtree is relatively new, but it fits my needs perfectly. Any other alternatives for automating the sync process would be greatly appreciated!


Solution

  • subtree is an external script. git's subcommand-handling lets you use as git subtree but it's not a git function but something which composes commands together to do a few diverse things.

    libgit2 doesn't have an implementation of subtree commands, just as git doesn't either, and it may never do directly. What it should provide is enough to build a subtree command on top its functionality.

    The one thing libgit2 doesn't support currently is the 'subtree' merge strategy, but whenever that goes in, there shouldn't be any more impediments to implement subtree on top of libgit2.