r-git

r-git is an executable gem for managing multiple git repositories within a single top level directory. Fetch, pull, change branch and status commands can be easily issued across all git repositories that reside within the top level directory.

r-git running in terminal

Installation

Install it by running:

$ gem install r-git

How It Works

Imagine the scenario where you have several git projects under some parent:

└── personal-projects
    ├── arbitary-sub-folder
    │   ├── projectX (git repo)
    │   ├── projectY (git repo)
    └── r-git (git repo)
└── work-projects
  ├── repo-one (git repo)
  └── repo-two (git repo)

r-git has the concepts of 'roots' in our scenario personal-projects and work-projects are our roots. I register these by running the following from within each folder:

$ rgit add-root

Running any of the following commands will result in that command being executed across all projects within the root:

  • rgit status
    Status of all repositories
  • rgit pull
    Execute git pull on all repositories
  • rgit fetch
    Execute git fetch on all repositories
  • rgit checkout development
    Execute git checkout development on all repositories

For example: executing rgit fetch from within any folder in personal-projects will run git fetch on all repositories in that folder/root.

It's that simple!