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

sirup

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

Who Needs This?

In your computer you might have a directory containing many git repositories. These could be personal projects, college assignments or codebases from work.

Now imagine you just got a new computer and need to move all these repositories to it. If you have hundreds of repos, you'd probably need to copy gigabytes of data. This could take time. Your old computer is probably slow, making this worse. You could first delete your node_modules, build files, etc, but this would be really tedious. It would also be tedious to figure out which repo is clean or dirty, which repo is synced to its remote, and so on.

Enter sirup. This tool will show you a JSON summary of all your git repositories. You could analyse the JSON using any standard tool to figure out…

Hope this helps anyone who runs into a similar situation.

Top comments (1)

Collapse
 
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.

50 CLI Tools You Can't Live Without

The top 50 must-have CLI tools, including some scripts to help you automate the installation and updating of these tools on various systems/distros.