Git Product home page Git Product logo

git-subsplit's Introduction

Git Subsplit

Automate and simplify the process of managing one-way read-only subtree splits.

Git subsplit relies on subtree being available. If is not available in your version of git (likely true for versions older than 1.7.11) please install it manually from here.

Install

git-subsplit can be installed and run standalone by executing git-subsplit.sh directly.

git-subsplit can also be installed as a git command by:

./install.sh

Caveats

There is a known bug in the underlying git-subtree command that this script uses. Your disk will eventually run out of inodes because a cache directory isn't cleaned up after every run. I suggest you to create a cronjob to clean the cache directory every month:

0	0	1	*	*	 rm -rf <path to>/dflydev-git-subsplit-github-webhook/temp/$projectname/.subsplit/.git/subtree-cache/*

Hooks

GitHub WebHooks

Usage

Initialize

Initialize subsplit with a git repository url:

git subsplit init https://github.com/react-php/react

This will create a working directory for the subsplit. It will contain a clone of the project's upstream repository.

Update

Update the subsplit repository with current state of its upstream repository:

git subsplit update

This command should be called before one or more publish commands are called to ensure that the repository in the working directory has been updated from its upstream repository.

Publish

Publish to each subtree split to its own repository:

git subsplit publish \
    src/React/EventLoop:[email protected]:react-php/event-loop.git \
    --heads=master

The pattern for the splits is ${subPath}:${url}. Publish can receive its splits argument as a space separated list:

git subsplit publish "
    src/React/EventLoop:[email protected]:react-php/event-loop.git
    src/React/Stream/:[email protected]:react-php/stream.git
    src/React/Socket/:[email protected]:react-php/socket.git
    src/React/Http/:[email protected]:react-php/http.git
    src/React/Espresso/:[email protected]:react-php/espresso.git
" --heads=master

This command will create subtree splits of the project's repository branches and tags. It will then push each branch and tag to the repository dedicated to the subtree.

--update

Passing --update to the publish command is a shortcut for calling the update command directly.

--heads=<heads>

To specify a list of heads (instead of letting git-subsplit discover them from the upstream repository) you can specify them directly. For example:

--heads="master 2.0"

The above will only sync the master and 2.0 branches, no matter which branches the upstream repository knows about.

--no-heads

Do not sync any heads.

--tags=<tags>

To specify a list of tags (instead of letting git-subsplit discover them from the upstream repository) you can specify them directly. For example:

--tags="v1.0.0 v1.0.3"

The above will only sync the v1.0.0 and v1.0.3 tags, no matter which tags the upstream repository knows about.

--no-tags

Do not sync any tags.

--rebuild-tags

Ordinarily tags will not be synced more than once. This is because in general tags should be considered or or less static.

If for some reason tags need to be resynced from scratch (history changed so tags might point to somewhere else) this flag will get the job done.

-q,--quiet

As little output as possible.

-n,--dry-run

Does not actually publish information to the subsplit repos for each subtree split. Instead, display the command and execute the command with --dry-run included.

--debug

Allows you to see the logic behind the scenes.

Not Invented Here

Inspiration for writing this came from Guzzle's goal of providing components as individually managed packages. Having seen this already done by Symfony and liking how it behaved I wanted to try and see if I could solve this problem in a general case so more people could take advantage of this workflow.

Much time was spent checking out git-subtree and scripts written for managing React's components.

License

MIT, see LICENSE.

Community

If you have questions or want to help out, join us in the #dflydev channel on irc.freenode.net.

git-subsplit's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.