Files
obsidian-vault/work/apple-browsers-worktree-workflow.md
T

1.5 KiB
Executable File

Apple Browsers: Git worktrees

Keep one shared Git database at ~/DuckDuckGo/apple-browsers.git/.git and put independent checkouts beside it inside apple-browsers.git/. The container directory has no checked-out source of its own.

First-time setup

mkdir -p ~/DuckDuckGo/apple-browsers.git
git clone --bare https://github.com/duckduckgo/apple-browsers.git ~/DuckDuckGo/apple-browsers.git/.git
cd ~/DuckDuckGo/apple-browsers.git
git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
git fetch origin
git worktree add main main

This matches the local layout: .git/ holds shared history; main/ is a normal checkout. Access to private dependencies may be needed to build; see README.md inside a checkout.

Work on a branch

From ~/DuckDuckGo/apple-browsers.git:

git fetch origin
git worktree add -b yourname/my-feature my-feature origin/main
cd my-feature
git submodule update --init --recursive
open DuckDuckGo.xcworkspace

Edit, build, commit, and push inside my-feature/ as with any clone. Each worktree has its own working files and branch; they share the same Git history. For an existing local branch, use git worktree add <folder> <branch>; for a remote branch, use git worktree add --track -b <branch> <folder> origin/<branch> if you have not created it locally.

Use git worktree list to find checkouts. After checking that a checkout has no work to keep, run git worktree remove <folder> from the container directory. The branch remains available.