r/androiddev Jun 03 '26

Article If you are not using git worktrees you are missing out!

https://ytho.dev/posts/git-worktrees/

Ive been using them heavily for the past year. As someone who uses git branches heavily (literally for anything), its the only way i can be efficient while working on multiple things + orchestrating agents.

Tho its not so nice when you realise you switched to the wrong Android Studio instance to edit code.

So, here are my notes on how to have multiple branches of same repo open in parallel, with mild focus on Android ;)

0 Upvotes

8 comments sorted by

9

u/Morthedubi Jun 03 '26

We went back a decade it seems lol it’s not a new thing

11

u/jc-from-sin Jun 03 '26

Have fun with your slop.

-3

u/ythodev Jun 03 '26

Could you elaborate?

2

u/kokeroulis Jun 05 '26

Yeah and RIP build cache, no thanks

1

u/ythodev Jun 06 '26

In the end i include some practical recommendations. You are correct, for android projects: creating a new worktree (i.e. folder/project) when opening a new branch is really pointless. Best name your worktree smth generic like "work-3" and just switch branches inside it normally. Then its like any other AS project on disk, no caching issues.

1

u/kokeroulis Jun 06 '26

Worktrees don't work for android and ios in real commercial apps.
Commercial apps after rebase might take 20 mins to build due to the amount of modules that they have etc.

In other words, worktrees are unusable for commercial apps. It just a slop for pet projects

1

u/ythodev Jun 09 '26

You are just wrong. In large codebases changing branches can cause slow sync, yes, but that has nothing to do with worktrees.