DEV Community

Remi Kristelijn
Remi Kristelijn

Posted on

Easy switching git projects

If you are working a lot of git projects, like maintaining things, having to bump versions, doing npm outdated or npm upgrade, maybe you want to quickly see what node version it runs in, as this needs to change two times a year.

Probably you have one folder on your machine containing all your projects, maybe even nested in groups. But do you remember each path and do you like typing and cd'ing into them? I'm sure it gets annoying at some time, at least that's what happened to me.

I started using aliasses in .zshrc to quickly cd into them however the amount of projects kept growing. There must be some way to list them, because they all have a .git folder in them. So I created Lcode.

Lcode lists your repos in a specific folder (the root folder of your projects). After choosing, it changes directory for that folder and you can configure to run your favorite command, or just start bash or zsh, or even fire up Visual Studio Code.

In my example below the 'command' in the config file checks for the existence of a .nvmrc file and it it exists, runs nvm to switch to the proper node version for that project.

You can either use the defaults, add command arguments or generate a config file to persist them.

https://www.npmjs.com/package/@rkristelijn/lcode

Top comments (0)