You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/docs/en/guide/cli/setup.mdx
+33-5Lines changed: 33 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,12 +41,26 @@ rs staged
41
41
42
42
:::warning Existing Git hook managers
43
43
44
-
`rs setup` updates the repository's [`core.hooksPath`](https://git-scm.com/docs/git-config#Documentation/git-config.txt-corehooksPath). It skips installation when another hooks path or existing Git hook is detected. Migrate the required hooks and remove the existing hooks configuration before running the command.
44
+
`rs setup` updates the repository's [`core.hooksPath`](https://git-scm.com/docs/git-config#Documentation/git-config.txt-corehooksPath). It skips installation when another hooks path or existing Git hook is detected. Run `rs setup --force` to install Rstack hooks anyway.
45
45
46
46
:::
47
47
48
48
## Options
49
49
50
+
### `--force`
51
+
52
+
`--force` (or `-f`) installs Rstack hooks even when an existing Git hooks setup is detected:
53
+
54
+
```bash
55
+
rs setup --force
56
+
```
57
+
58
+
Rstack preserves the existing hook files and sets `core.hooksPath` to its generated hooks directory. While this setting is active, Git no longer runs hooks from the previous location.
59
+
60
+
:::tip
61
+
Run `rs setup --force` only once. Use `rs setup` without `--force` in the `prepare` script.
62
+
:::
63
+
50
64
### `--hooks-dir`
51
65
52
66
Sets the directory for hook scripts, relative to the Git repository root.
@@ -171,23 +185,37 @@ To change the owner, remove `rs setup` from the previous project's `prepare` scr
171
185
To remove hooks managed by Rstack CLI:
172
186
173
187
1. Remove `rs setup` from the `prepare` script.
174
-
2. Unset the repository's hooks path:
188
+
2. Check which Git configuration scope defines the active hooks path:
189
+
190
+
```bash
191
+
git config --show-scope --get core.hooksPath
192
+
```
193
+
194
+
3. Unset the hooks path in the reported scope. For `local`, run:
175
195
176
196
```bash
177
197
git config --local --unset core.hooksPath
178
198
```
179
199
180
-
3. Delete `.rstack/hooks/`, or the directory passed to `--hooks-dir`.
200
+
For `worktree`, run:
201
+
202
+
```bash
203
+
git config --worktree --unset core.hooksPath
204
+
```
205
+
206
+
If `--force` previously preserved hooks under `.git/hooks`, unsetting the path reactivates those files. Delete any obsolete files first if you do not want them to run.
207
+
208
+
4. Delete `.rstack/hooks/`, or the directory passed to `--hooks-dir`.
181
209
182
210
## Troubleshooting
183
211
184
212
### Hook does not run
185
213
186
214
- Check that the hook script has a [supported name](#supported-hooks) and is next to the `_` directory.
187
-
- Run `git config --local --get core.hooksPath` and verify the configured path.
215
+
- Run `git config --show-scope --get core.hooksPath` and verify the effective scope and path.
188
216
- Rerun `rs setup` to restore generated files and executable permissions.
189
217
- Check that `RSTACK_HOOKS` is not set to `0` in the environment or initialization file.
190
-
- If another hooks setup is reported, migrate or remove the conflicting setup before rerunning the command.
218
+
- If another hooks setup is reported, run `rs setup --force`.
191
219
- If another project is reported as the hooks owner, follow the ownership transfer steps in [Monorepo](#monorepo).
192
220
193
221
Hook scripts do not need to be executable because Rstack CLI runs them with `sh`.
Copy file name to clipboardExpand all lines: website/docs/en/guide/git-hooks.mdx
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,14 +36,14 @@ Run the script once to install the hooks:
36
36
`rs setup` sets the repository's `core.hooksPath` to `.rstack/hooks/_`. Verify the installation with:
37
37
38
38
```bash
39
-
git config --local --get core.hooksPath
39
+
git config --get core.hooksPath
40
40
# .rstack/hooks/_
41
41
```
42
42
43
43
:::tip
44
44
45
45
- The `_` directory is generated dynamically and ignored by Git by default.
46
-
- If `rs setup` detects another hooks path or existing Git hooks, it skips installation. Migrate any hooks you want to keep, remove the existing configuration, and then try again. See the [`rs setup` guide](./cli/setup#hook-files) for details.
46
+
- If `rs setup` detects another hooks path or existing Git hooks, it skips installation. Run `rs setup --force`to install Rstack hooks anyway. See the [`rs setup` guide](./cli/setup) for details.
0 commit comments