pmdaly
pmdaly

Reputation: 1222

Can I run a program that uses one git branch and work on another branch at the same time?

If I have two branches, master and new-feature, can I run a program that uses master then switch to new-feature without effecting the original program?

Upvotes: 3

Views: 1183

Answers (2)

Jacob Topping
Jacob Topping

Reputation: 126

You can use git checkout new-feature to switch to the code for the feature. This way, you can work on it as you like, without effecting the live site at master.

Upvotes: 0

Romain Valeri
Romain Valeri

Reputation: 22017

At least these two possibilities to consider :

1) Clone your repo. Work on one repo, let the other one run your program. It seems the most straightforward way to go from what you describe.

2) Maybe look at git worktree

It allows you to check out multiple branches at once, in separate directories.

Your program could run on a version from branch A, while you work on branch B checked out on your second worktree.

Upvotes: 3

Related Questions