[2026-10-16] eagle: work/apple-browsers-worktree-workflow.md
This commit is contained in:
1 parent
8e37a51cbf
commit
d57ea4ec27
1 file changed
+22
-3
@@ -1,6 +1,10 @@
|
||||
# Apple Browsers: Git worktrees
|
||||
|
||||
A Git worktree is another checkout of the same repository. It lets you keep `main` and feature branches in separate folders, work on them independently, and share one Git history instead of cloning the repo again. In this setup, `apple-browsers.git/.git` stores that shared history; `main/` and feature folders are the worktrees.
|
||||
This instruction describes how to keep one shared Git database at e.g. `~/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.
|
||||
|
||||
Related: [Quickly add/remove/switch between worktrees](https://app.asana.com/1/137249556945/message/1210697449367306)
|
||||
|
||||
## First-time setup
|
||||
|
||||
@@ -15,6 +19,20 @@ git worktree add main main
|
||||
|
||||
## Work on a branch
|
||||
|
||||
```sh
|
||||
git fetch origin
|
||||
git worktree add local-folder-name author/branch-name
|
||||
cd local-folder-name
|
||||
git submodule update --init --recursive
|
||||
open DuckDuckGo.xcworkspace
|
||||
```
|
||||
|
||||
- Edit, build, commit, and push **inside** `**local-folder-name/**` as with any clone.
|
||||
- Each worktree has its own working files and branch; they share the same Git history.
|
||||
- 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 | grep branch-name-part` to find checkouts.
|
||||
## New branch creation
|
||||
|
||||
From `~/DuckDuckGo/apple-browsers.git`:
|
||||
|
||||
```sh
|
||||
@@ -25,6 +43,7 @@ git submodule update --init --recursive
|
||||
open DuckDuckGo.xcworkspace
|
||||
```
|
||||
|
||||
The `git worktree add -b` command creates `my-feature/` on a new branch based on `origin/main`. Edit, build, commit, and push inside that folder. 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.
|
||||
## Removing worktree
|
||||
|
||||
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.
|
||||
- After you finish working on your feature, run `git worktree remove <folder>` from the container directory.
|
||||
- If you need to remove a worktree with changes you don‘t need anymore, run `git worktree remove -f <folder>`
|
||||
Reference in new issue
Block a user