switchrepo — switch between Azure DevOps Git Repositories

mac8005
2 min readDec 8, 2022

--

Are you looking for a quick and easy way to switch between different Azure DevOps Git repositories in your terminal? Look no further! Introducing switchrepo, a new shell script plugin for oh-my-zsh that makes switching between repositories a breeze.

switchrepo is an open source plugin that can be downloaded from https://github.com/mac8005/switchrepo. To install switchrepo, follow these steps:

  1. Download the plugin:
git clone https://github.com/mac8005/switchrepo.git $ZSH/custom/plugins/switchrepo

2. Enable the plugin in your .zshrc file:

vi ~/.zshrc

Add switchrepo to the list of plugins you want to load.

3. Add the required environment variables to your ~/.zshenv file:

echo 'export SWITCHREPO_WORKROOT=/Users/massimo/Git/' >> ~/.zshenv
echo 'export SWITCHREPO_ORG=myorg' >> ~/.zshenv
echo 'export SWITCHREPO_PROJ=myproject' >> ~/.zshenv
echo 'export SWITCHREPO_PAT=mysecret' >> ~/.zshenv

Now that switchrepo is installed, you can use it to easily switch between your Azure DevOps Git repositories. Simply enter sr <substring of repository name> and switchrepo will check if the repository is already cloned in your SWITCHREPO_WORKROOT directory. If the repository exists, switchrepo will perform a git pull and switch the working directory to the Git repository. If the repository does not exist, switchrepo will clone the repository from Azure DevOps and then switch to the local repository folder.

With switchrepo, you can quickly and easily switch between your Azure DevOps Git repositories, saving you time and hassle. Try it out today!

--

--