DEV Community

Cover image for Sirup: A CLI tool to manage your local Git repositories
Neil Syiemlieh
Neil Syiemlieh

Posted on

Sirup: A CLI tool to manage your local Git repositories

Hey guys I made a CLI tool that might help you if you have a lot of git repositories in your computer.

The Problem

I recently got a new laptop which meant I had to move the 100+ repos I had in my old laptop. I couldn't simply move or copy all the repos because my old laptop was really slow. I thought I might as well just push all the repos to their remotes and then clone them from my new laptop, but then I realised it would be really tedious to cd into each one of the repos, figure out which repo is clean or dirty, which repo is synced to its remote, and so on. So I decided to create a script to help me.

Enter sirup

sirup will show you a JSON summary of all your git repositories. You could analyse the JSON using any standard tool to figure out the status of each repo. This helps you know which repos will need to be cleaned up. I personally like to use the interactive Node.js shell for this. Then you could move this JSON to another computer and generate the git repositories over there. In the process, you could also tweak this JSON so that in your destination computer, sirup would pick up these tweaks and behave accordingly.

Here's the project on GitHub:

GitHub logo mebble / sirup

A CLI tool for migrating your git repositories


Summarise a directory of git repos. Regenerate them from the summary.


  • Python 3 at /usr/bin/python3
  • Git 2.22 or above
  • Ensure that ~/.local/bin/ is in your $PATH environment variable
  • jq (optional) so you can use some handy recipes shown below


Install and update

curl --proto '=https' --tlsv1.2 -sSf | sh


curl --proto '=https' --tlsv1.2 -sSf | sh


Print the usage instructions by running:

sirup help


Usage: sirup <command> <args&gt
    help                        Print these usage instructions
    sum                         Summarise git repos and print the summary in JSON to stdout
        --repos ./repos/dir     The directory containing the git repos
        --log   [optional]      Will output logs to stdout
    gen                         Generate git repos from a summary file
        --from  ./sum/file      Path to the summary file
        --to    ./dest/dir      The destination directory where you want

Hope this helps anyone who runs into a similar situation.

Top comments (1)

jamesthomson profile image
James Thomson

100+ repos I had in my old laptop

Damn that's a lot of repos! Nice little tool you made to help you out. I've never had this problem myself, but I've always been involved in fairly long lived projects so I'll only have a few active repos going at most at one time.

Interesting to see the pains other developers deal with and resolutions to them.