Giter Club home page Giter Club logo

git-join-repos's Introduction

Git Repository Join

Combines separate git repositories into a single monolithic git repository, prepending the source repo name to every commit message. It only includes master branches from each repository, but otherwise complete version history is maintained. Mainly just a convenient bash wrapper around git commands.

Usage

Run the script from inside an empty git repository, for example:

#Describe the source repositories, see below for file format
$EDITOR repo_data.txt

#make an empty repository
git init $repo_name
cd $repo_name

#Run the merge/join tool
~/path/to/git-join-repos ../repo_data.txt

#Add the monolithic remote, this is just an example, plug in your actual remote:
#Be sure to run this step *after* the join tool.
git remote add origin [email protected]:username/monolithic.git

#Push it when you're ready
git push origin master

where repo_data.txt is in the format:

repo1 [email protected]:username/repo1.git
newname [email protected]:username/repo2.git
repo3 /path/locally/repo3

each row is separated by a newline and the name and url are separated by a space character (tabs not supported!).

Expected Result

Your new top-level working directory will contain:

repo1
newname
repo3

Where each subfolder contains the HEAD master commit from the corresponding source repository. n.b. old commit ids are lost in this process - so don't count on being able to reference your new repository with old commit ids.

Each commit message will be retained, but prepended with the name of the source repository.

git log --oneline --graph --decorate

*   c91baa3 (HEAD -> master, origin/master) repo3: git-join-repos monolithic conversion merge
|\  
| * 106a74c repo3: add keyed message storage
| * c48e9f2 repo3: add build/.npmignore
| * 2766e11 repo3: fix build/.gitignore
| * dcef023 repo3: initial commit of repo3
*   b7530e7 newname: git-join-repos monolithic conversion merge
|\  
| * 02f3536 newname: update sublibrary to versionf 1.4
...

Contributions

Pull requests are welcome

git-join-repos's People

Contributors

chrishiestand avatar

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.