Skip to content

Commit 4bb4bdf

Browse files
committed
Add slide on git worktrees
I have found these really useful when dealing with messy repositories in the past.
1 parent 4df5a93 commit 4bb4bdf

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/version_control.qmd

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,17 @@ it will be true.
2929
- Use .gitignore to automatically ignore any unwanted files
3030
- e.g. build outputs
3131

32+
## Aside - testing with worktrees
33+
34+
- git worktrees are like "local clones" of a repository
35+
- Create a worktree:
36+
``` bash
37+
git worktree add -b <new-branch-name> <path>
38+
```
39+
- Will make a new directory, with only files that are tracked
40+
- Can use as a cleanroom to ensure all dependencies are there
41+
- For more info: `git worktree add --help`
42+
3243
## What to do next?
3344

3445
- The repository can then also be hosted a remote service (e.g. GitHub, GitLab, Codeberg, Bitbucket)

0 commit comments

Comments
 (0)