DEV Community

Tom
Tom

Posted on • Updated on

Quickly switch projects

As I work on different projects at the same time, I want to be able to switch quickly between them. So if I need to work on Project-x I just run in the terminal:

projectx
Enter fullscreen mode Exit fullscreen mode

VS Code is opened at the right project, the web server starts and opens a browser on the correct URL.

This is easily done by adding an alias projectx to your .bashrc or .zshrc with the following contents:

alias projectx="cd /Users/tom/projects/project-x && code . && npm run dev"
Enter fullscreen mode Exit fullscreen mode

Bonus:

How to get the right path? Run pwd | pbcopy in the root dir of your project.

Top comments (0)