|
| 1 | +# TAGLINE |
| 2 | + |
| 3 | +print the root directory of a Jujutsu workspace |
| 4 | + |
| 5 | +# TLDR |
| 6 | + |
| 7 | +**Print** the current workspace root |
| 8 | + |
| 9 | +```jj workspace root``` |
| 10 | + |
| 11 | +Use the path in a **script** |
| 12 | + |
| 13 | +```cd "$(jj workspace root)"``` |
| 14 | + |
| 15 | +Print the root of a **named workspace** |
| 16 | + |
| 17 | +```jj workspace root --name [workspace_name]``` |
| 18 | + |
| 19 | +Avoid snapshotting (common in **prompts**) |
| 20 | + |
| 21 | +```jj --ignore-working-copy workspace root``` |
| 22 | + |
| 23 | +# SYNOPSIS |
| 24 | + |
| 25 | +**jj workspace root** [_options_] |
| 26 | + |
| 27 | +# PARAMETERS |
| 28 | + |
| 29 | +**--name** _NAME_ |
| 30 | +> Workspace to query. Defaults to the current workspace. |
| 31 | +
|
| 32 | +# DESCRIPTION |
| 33 | + |
| 34 | +**jj workspace root** prints the absolute path of a workspace root: the directory that contains the working copy and the `.jj/` metadata. |
| 35 | + |
| 36 | +With no **--name**, it reports the workspace that contains the current directory. That is the same result as **jj root**, which is a shortcut for this command without extra flags. **--name** selects another workspace attached to the same repository. |
| 37 | + |
| 38 | +This is the Jujutsu counterpart of `git rev-parse --show-toplevel`. It is **not** the Git directory; for that path use **jj git root**. |
| 39 | + |
| 40 | +Like other jj commands, **jj workspace root** snapshots the working copy unless you pass **--ignore-working-copy**. Shell prompts that only need the path typically use that flag. |
| 41 | + |
| 42 | +# CAVEATS |
| 43 | + |
| 44 | +Subcommand of **jj**. Fails outside a workspace. **jj root** does not accept **--name**. Do not confuse with **jj git root**. |
| 45 | + |
| 46 | +# INSTALL |
| 47 | + |
| 48 | +```pacman: sudo pacman -S jujutsu``` |
| 49 | + |
| 50 | +```apk: sudo apk add jujutsu``` |
| 51 | + |
| 52 | +```zypper: sudo zypper install jujutsu``` |
| 53 | + |
| 54 | +```brew: brew install jujutsu``` |
| 55 | + |
| 56 | +```nix: nix profile install nixpkgs#jujutsu``` |
| 57 | + |
| 58 | +<!-- packages: 2026-09-26 --> |
| 59 | + |
| 60 | +# SEE ALSO |
| 61 | + |
| 62 | +[jj-workspace](/man/jj-workspace)(1), [jj-root](/man/jj-root)(1), [jj-git-root](/man/jj-git-root)(1), [jj](/man/jj)(1), [git-rev-parse](/man/git-rev-parse)(1) |
| 63 | + |
| 64 | +# RESOURCES |
| 65 | + |
| 66 | +```[Source code](https://github.com/jj-vcs/jj)``` |
| 67 | + |
| 68 | +```[Homepage](https://jj-vcs.github.io/jj/)``` |
| 69 | + |
| 70 | +```[Documentation](https://docs.jj-vcs.dev/latest/cli-reference/#jj-workspace-root)``` |
| 71 | + |
| 72 | +<!-- verified: 2026-09-26 --> |
0 commit comments