Skip to content

Conversation

@guzman-raphael
Copy link
Contributor

Recently I've learned about Git Worktrees. It is a feature somewhere between Git Stash and completely copying/cloning a repo again.

It is great for context switching and superior to stash because it:

  • Creates a separate directory on your machine.
  • Synchronizes Git between them without duplicating Git history i.e. ensures it is up to date and prevents collisions.

Because of this setup, you can launch separate DevContainers in parallel. This is useful because:

  • It is less disruptive if you are deep into some uncommitted changes.
  • You have access to rust analyzer/clippy e.g. when reviewing other PRs.
  • It makes it easier to work on refactor/migrations between branches/stashes with separate tooling e.g. tests, runable notebooks, etc.
  • It allows vibe coding iteration to continue in the background.

However, some changes were necessary to make our setup compatible with this.

Pre-requisites

  • Update your git to at least version 2.48 since that is when the --relative-paths option was added to git worktree.
  • Create worktrees on your machine using the following command.
    git worktree add /path/to/new/dir-name branch-name --relative-paths # create
    git worktree remove dir-name # delete

Changes

  • Convert default DevContainer to compose since it allows setting DevContainer config dynamically.
  • Switch DevContainer image since installing latest git is easiest on ubuntu.
  • Add DevContainer prelaunch script that determines appropriate mount points.

…ntainer config dynamically, switch DevContainer image since installing latest git is easiest on ubuntu, and add DevContainer prelaunch script that determines appropriate mount points.
@guzman-raphael guzman-raphael requested a review from Synicix August 2, 2025 10:43
@codecov
Copy link

codecov bot commented Aug 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Contributor

@Synicix Synicix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed over zoom, and everything looks good

@Synicix Synicix merged commit 74c2612 into nauticalab:dev Aug 8, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants