Using Git worktrees for development

submited by
Style Pass
2025-08-04 17:30:06

When working on iOS applications, I often find myself in situations where I need to develop a new feature while simultaneously fixing a bug. This can be challenging to manage, especially when the changes for the feature and the bug fix overlap. Developers have different approaches to handle this:

Git worktree is a lesser-known feature of Git that I wish I had started using sooner. It allows you to check out multiple branches of the same repository at the same time. This means you can work on a feature branch and a bug fix branch simultaneously, without needing to stash changes or create temporary commits.

This creates a new directory (../bugfix-branch) where the bugfix-branch is checked out. You can now work on this branch independently of your current branch.

This will check out the tag v1.2.3 in a new worktree so you can inspect or modify files without switching branches in your main working directory.

Leave a Comment
Related Posts