Hacker News new | ask | show | jobs
by CompuIves 1250 days ago
Ah right, the main advantage I have here is that the dev server also stays running when I go to another branch (since it's a different VM). So I can work on one thing, share it with the team and in the meantime continue on another branch. They can see the devserver / running code, while I am working on something else.

It's especially useful for things like migrations or dependency management. In one branch I could work on something that has some database migrations, and then I can still switch to other branches without having to roll back the migrations.

I didn't know about git worktrees though! I'm going to read up on this.

2 comments

> In one branch I could work on something that has some database migrations, and then I can still switch to other branches without having to roll back the migrations.

This is a good use case of git worktree.

> I didn't know about git worktrees though! I'm going to read up on this.

Indeed, you will like it.

The only limitation is that you cannot checkout the same branch in multiple worktree.

> In one branch I could work on something that has some database migrations, and then I can still switch to other branches without having to roll back the migrations.

I would love to have this workflow locally.

> I would love to have this workflow locally.

You too should check worktree. (See my other comment)