diff --git a/work/apple-browsers-worktree-workflow.md b/work/apple-browsers-worktree-workflow.md new file mode 100644 index 00000000..53888c83 --- /dev/null +++ b/work/apple-browsers-worktree-workflow.md @@ -0,0 +1,32 @@ +# 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 + +```sh +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`: + +```sh +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 `; for a remote branch, use `git worktree add --track -b origin/` 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 ` from the container directory. The branch remains available.