{"id":13397536,"url":"https://github.com/splitsh/lite","last_synced_at":"2025-05-15T16:05:02.466Z","repository":{"id":37405766,"uuid":"59808890","full_name":"splitsh/lite","owner":"splitsh","description":"Split a repository to read-only standalone repositories","archived":false,"fork":false,"pushed_at":"2024-03-08T13:12:55.000Z","size":99,"stargazers_count":1560,"open_issues_count":17,"forks_count":69,"subscribers_count":38,"default_branch":"master","last_synced_at":"2025-04-07T21:12:50.617Z","etag":null,"topics":["git","monolithic","monorepo","split","subtree","synchronization"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/splitsh.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-05-27T06:15:43.000Z","updated_at":"2025-03-21T15:42:57.000Z","dependencies_parsed_at":"2024-06-18T15:36:51.596Z","dependency_job_id":"786b4971-0d85-40a8-828d-357c98c29e2a","html_url":"https://github.com/splitsh/lite","commit_stats":{"total_commits":39,"total_committers":12,"mean_commits":3.25,"dds":0.5128205128205128,"last_synced_commit":"01594a43d092a67b494c32f3a013954c4473e0e0"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splitsh%2Flite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splitsh%2Flite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splitsh%2Flite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splitsh%2Flite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/splitsh","download_url":"https://codeload.github.com/splitsh/lite/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254374410,"owners_count":22060610,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git","monolithic","monorepo","split","subtree","synchronization"],"created_at":"2024-07-30T18:01:29.421Z","updated_at":"2025-05-15T16:05:02.449Z","avatar_url":"https://github.com/splitsh.png","language":"Go","readme":"Git Subtree Splitter\n====================\n\n**splitsh-lite** replaces the `subtree split` Git built-in command to make\n**splitting a monolithic repository** to read-only standalone repositories\n**easy and fast**.\n\nWhy do I need this tool?\n------------------------\n\nWhen starting a project, do you store all the code in one repository? Or are\nyou creating many standalone repositories?\n\nBoth strategies work well and both have drawbacks as well. **splitsh** helps\nuse both strategies by providing tools that automatically **synchronize a\nmonolithic repository to standalone repositories** in real-time.\n\n**splitsh-lite** is a sub-project that provides a faster implementation of the\n`git subtree split` command, which helps create standalone repositories for one\nor more sub-directories of a main repository.\n\nIf you want to learn more about monorepo vs manyrepos, watch this [4-minute\nlightning talk](http://www.thedotpost.com/2016/05/fabien-potencier-monolithic-repositories-vs-many-repositories)\nI gave at dotScale\n(or [read the slides](https://speakerdeck.com/fabpot/a-monorepo-vs-manyrepos))...\nor watch the longer version from\n[DrupalCon](https://www.youtube.com/watch?v=4w3-f6Xhvu8).\n[\"The Monorepo - Storing your source code has never been so much fun\"](https://speakerdeck.com/garethr/the-monorepo-storing-your-source-code-has-never-been-so-much-fun)\nis also a great resource.\n\n**Note** If you currently have multiple repositories that you want to merge into\na monorepo, use the [tomono](https://github.com/unravelin/tomono) tool.\n\nInstallation\n------------\n\nManual Installation\n-------------------\n\nFirst, you need to install `libgit2`, preferably using your package manager of\nchoice.\n\nIf you get `libgit2` version `1.5`, you're all set and jump to the compilation\nstep below. If not, you first need to change the `git2go` version used in the\ncode. Using the table on the\n[libgit2](https://github.com/libgit2/git2go#which-go-version-to-use) repository,\nfigure out which version of the `git2go` you need based on the `liggit2` library\nyou installed. Let's say you need version `v31`:\n\n```bash\nsed -i -e 's/v34/v31/g' go.mod splitter/*.go\ngo mod tidy\n```\n\nThen, compile `splitsh-lite`:\n\n```bash\ngo build -o splitsh-lite github.com/splitsh/lite\n```\n\nIf everything goes fine, a `splitsh-lite` binary should be available in the\ncurrent directory.\n\nIf you get errors about an incompatible `libgit2` library, try exporting the\nneeded flags, e.g.\n\n```bash\nexport LDFLAGS=\"-L/opt/homebrew/opt/libgit2@1.5/lib\"\nexport CPPFLAGS=\"-I/opt/homebrew/opt/libgit2@1.5/include\"\nexport PKG_CONFIG_PATH=\"/opt/homebrew/opt/libgit2@1.5/lib/pkgconfig\"\n```\n\nbefore running `go build`.\n\nIf you want to integrate splitsh with Git, install it like this (and use it via\n`git splitsh`):\n\n```bash\ncp splitsh-lite \"$(git --exec-path)\"/git-splitsh\n```\n\nUsage\n-----\n\nLet's say you want to split the `lib/` directory of a repository to its own\nbranch; from the \"master\" Git repository (bare or clone), run:\n\n```bash\nsplitsh-lite --prefix=lib/\n```\n\nThe *sha1* of the split is displayed at the end of the execution:\n\n```bash\nSHA1=`splitsh-lite --prefix=lib/`\n```\n\nThe sha1 can be used to create a branch or to push the commits to a new\nrepository.\n\nAutomatically create a branch for the split by passing a branch name\nvia the `--target` option:\n\n```bash\nsplitsh-lite --prefix=lib/ --target=heads/branch-name\n```\n\nIf new commits are made to the repository, update the split by running the same\ncommand again. Updates are much faster as **splitsh-lite** keeps a cache of\nalready split commits. Caching is possible as **splitsh-lite** guarantees that\ntwo splits of the same code always results in the same history and the same\n`sha1`s for each commit.\n\nBy default, **splitsh-lite** splits the currently checked out branch but you can\nsplit a different branch by passing it explicitly via the `--origin` flag\n(mandatory when splitting a bare repository):\n\n```bash\nsplitsh-lite --prefix=lib/ --origin=origin/master\n```\n\nYou don't even need to run the command from the Git repository directory if you\npass the `--path` option:\n\n```bash\nsplitsh-lite --prefix=lib/ --origin=origin/1.0 --path=/path/to/repo\n```\n\nAvailable options:\n\n * `--prefix` is the prefix of the directory to split; the value can be one of\n   the following:\n\n     * `from`: the origin directory to split;\n\n     * `from:to`: move the split content to a sub-directory on the target;\n\n     * `from:to:exclude`: exclude a directory from the origin `from` directory\n       (use `from:to:exclude1:exclude2:...` to exclude more than one\n       directory).\n\n   Split several directories by passing multiple `--prefix` flags;\n\n * `--path` is the path of the repository to split (current directory by default);\n\n * `--origin` is the Git reference for the origin (can be any Git reference\n   like `HEAD`, `heads/xxx`, `tags/xxx`, `origin/xxx`, or any `refs/xxx`);\n\n * `--target` creates a reference for the tip of the split (can be any Git\n   reference like `heads/xxx`, `tags/xxx`, `origin/xxx`, or any `refs/xxx`);\n\n * `--progress` displays a progress bar;\n\n * `--scratch` flushes the cache (useful when a branch is force pushed or in\n   case of a cache corruption).\n\nMigrating from `git subtree split`\n----------------------------------\n\nMigrating from `git subtree split` to `splith-lite` is easy as both tools\ngenerate the same `sha1`s.\n\nHowever, note that older versions of `git subtree split` used broken\nalgorithms, and so generated different `sha1`s than the latest version. You can\nsimulate those version via the `--git` flag. Use `\u003c1.8.2` or `\u003c2.8.0` depending\non which version of `git subtree split` you want to simulate.\n","funding_links":[],"categories":["Go","版本控制系统和附加组件"],"sub_categories":["Git"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsplitsh%2Flite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsplitsh%2Flite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsplitsh%2Flite/lists"}