Giter Club home page Giter Club logo

git-split-branch's Introduction

git-split-branch

git-split-branch splits a single git branch into multiple branches, each of which contains a specified set of the original branch's files and only the commits which affect that set.

This is a similar effect to what git-filter-branch would produce by using an index filter to select specific files. (In fact, git-split-branch is obviously and unabashedly modified from git-filter-branch.) But unlike...

  • git-subtree, it can split off an arbitrary set of files, not just a subdirectory.
  • git-filter-branch, it can create multiple branches.
  • multiple git-filter-branch calls, it only requires one pass over the commit history.
  • other scripts that wrap git-filter-branch, see one of the previous two points.

In addition, git-split-branch assigns the leftover files to a "remainder" branch or rewrites the original source branch to contain only the leftovers.

On the other hand, git-filter-branch allows for other filters to be applied, while git-split-branch is single in its purpose.

Install

Download and place git-split-branch somewhere in your $PATH, or symlink from its git repository to your $PATH.

No other setup is required before invoking as git split-branch.

Usage

git split-branch [-d <workdir>] [-r <remainder>] <source> <dest1> <paths1>... [ -- <dest2> <paths2>... ]...

This command will split the contents of the <source> branch, creating branch <dest1> to contain only files matching <paths1>, branch <dest2> to contain <paths2>, and so forth. The remaining unsplit files will be written to branch <remainder> if the -r flag is given; otherwise <source> will be rewritten to contain the remaining files only.

As with git-filter-branch, the directory in which work is done can be specified (e.g. on a tmpfs) with -d.

Motivation

This utility was motivated by the desire to migrate a large $HOME repository to vcsh. This repository contained seven years of configuration, grad school work, personal writings, code for side projects, etc. It had originally been hosted in Subversion as a single, large repository, and it was later converted to Git via git-svn but not restructured into smaller, more logical units. git-split-branch was written to split this repository into smaller units without having to iterate seven years of commits for every split.

The tool took 24 minutes to split 2750 commits into 60 branches.

git-split-branch's People

Contributors

djpohly avatar basile-henry avatar goetzk avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

tue-robotics

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.