...

/

Refactoring Multi-git to use Viper

Refactoring Multi-git to use Viper

Let's revist the multi-git program and refactor it to use Viper in addition to Cobra.

In this lesson, we will refactor the multi-git program to use Viper in addition to Cobra. Along the way, we will change some design choices regarding configuration and consider alternative forms of configuration. At the end of the day, incorporating Viper is a relatively simple and streamlined process that brings a lot of value and flexibility to multi-git.

Overview

Let’s rethink the configuration of multi-git and use our new shiny toy Viper to make it better. We will look at binding the Cobra command lines into Viper in addition to adding a configuration file. However, it’s also important to consider backwards compatibility when making changes that can potentially break a user’s code or even habits.

Re-designing the multi-git user experience

As you recall multi-git operates on a root directory and set of repos and executes a set of identical git commands on all the repos.

The use case is a set of related git repos where you often need to make changes across the same repos. With multi-git, you can create a branch across all the repos, make changes, commit them, and ...