Skip to content

Commit 691060e

Browse files
fix(docs): use git pull instead of git fetch in pre-switch hook example (#1323)
## Summary - Change the `pre-switch` hook example from `git fetch` to `git pull` - `git fetch` only updates remote tracking refs without advancing the local branch, so a new worktree created after fetch is still based on the old local HEAD — not the latest remote Reported by @jdb8 in #1085. ## Test plan - [x] Doc sync test passes (docs and skill reference updated automatically) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 05d37ad commit 691060e

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

docs/content/hook.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ Runs before every `wt switch` — before branch validation or worktree creation.
4040

4141
```toml
4242
[pre-switch]
43-
# Fetch if last fetch was more than 6 hours ago
44-
fetch = """
43+
# Pull if last fetch was more than 6 hours ago
44+
pull = """
4545
FETCH_HEAD="$(git rev-parse --git-common-dir)/FETCH_HEAD"
4646
if [ "$(find "$FETCH_HEAD" -mmin +360 2>/dev/null)" ] || [ ! -f "$FETCH_HEAD" ]; then
47-
git fetch
47+
git pull
4848
fi
4949
"""
5050
```

skills/worktrunk/reference/hook.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ Runs before every `wt switch` — before branch validation or worktree creation.
3131

3232
```toml
3333
[pre-switch]
34-
# Fetch if last fetch was more than 6 hours ago
35-
fetch = """
34+
# Pull if last fetch was more than 6 hours ago
35+
pull = """
3636
FETCH_HEAD="$(git rev-parse --git-common-dir)/FETCH_HEAD"
3737
if [ "$(find "$FETCH_HEAD" -mmin +360 2>/dev/null)" ] || [ ! -f "$FETCH_HEAD" ]; then
38-
git fetch
38+
git pull
3939
fi
4040
"""
4141
```

src/cli/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,11 +1080,11 @@ Runs before every `wt switch` — before branch validation or worktree creation.
10801080
10811081
```toml
10821082
[pre-switch]
1083-
# Fetch if last fetch was more than 6 hours ago
1084-
fetch = """
1083+
# Pull if last fetch was more than 6 hours ago
1084+
pull = """
10851085
FETCH_HEAD="$(git rev-parse --git-common-dir)/FETCH_HEAD"
10861086
if [ "$(find "$FETCH_HEAD" -mmin +360 2>/dev/null)" ] || [ ! -f "$FETCH_HEAD" ]; then
1087-
git fetch
1087+
git pull
10881088
fi
10891089
"""
10901090
```

0 commit comments

Comments
 (0)