|
|
|
|
|
by jnurmine
1469 days ago
|
|
Suppose you have one repo with branches main, v1 and v2 (for example, releases are made from these). The branches are there forever, they are very long running branches. Some days you work with v1 and some days with v2, and sometimes with main. Sometimes fixes are quick, sometimes not. Sometimes you must switch the working branch while you are in the middle of doing something that is not quite finished. If you need to change between v1, v2 or main, just change a directory. Done. So for the above example, setting up this: cd repo
git checkout -b main origin/main
git worktree add ../v1 origin/v1
git worktree add ../v2 origin/v2
I.e. having a separate worktree for each long running branch makes working with the branches so much easier.Edit: formatting |
|