Skip to content

Commit 3375049

Browse files
committed
Add commands
1 parent 83d6fda commit 3375049

6 files changed

Lines changed: 297 additions & 1 deletion

File tree

‎assets/commands/index.txt‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3814,10 +3814,14 @@ jj-file-search.md
38143814
jj-file-show.md
38153815
jj-file.md
38163816
jj-git-clone.md
3817+
jj-git-colocation.md
3818+
jj-git-export.md
38173819
jj-git-fetch.md
3820+
jj-git-import.md
38183821
jj-git-init.md
38193822
jj-git-push.md
38203823
jj-git-remote.md
3824+
jj-git-root.md
38213825
jj-git.md
38223826
jj-interdiff.md
38233827
jj-log.md
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# TAGLINE
2+
3+
manage Git colocation of a Jujutsu workspace
4+
5+
# TLDR
6+
7+
**Show** whether the workspace is colocated with Git
8+
9+
```jj git colocation status```
10+
11+
**Enable colocation** (move the Git repo to `.git` at the workspace root)
12+
13+
```jj git colocation enable```
14+
15+
**Disable colocation** (hide the Git repo under `.jj`)
16+
17+
```jj git colocation disable```
18+
19+
# SYNOPSIS
20+
21+
**jj git colocation** _subcommand_
22+
23+
# PARAMETERS
24+
25+
**status**
26+
> Print whether the current workspace is colocated with Git.
27+
28+
**enable**
29+
> Convert into a colocated Jujutsu/Git workspace. Moves the backing Git repository from inside `.jj` to a `.git` directory at the workspace root so Git tools can operate on the same working copy.
30+
31+
**disable**
32+
> Convert into a non-colocated Jujutsu/Git workspace. Moves the `.git` directory at the workspace root into `.jj`. Git commands will no longer work directly in the workspace.
33+
34+
**-h**, **--help**
35+
> Display help information.
36+
37+
# DESCRIPTION
38+
39+
**jj git colocation** manages whether a Git-backed Jujutsu workspace is **colocated** with Git.
40+
41+
A colocated workspace is a hybrid Jujutsu/Git workspace: `.jj` and `.git` sit at the same root and share the working copy. This is the default for repositories created with **jj git init** or **jj git clone**. In that mode Jujutsu imports and exports Git refs automatically on every **jj** command, which is convenient when IDEs, `gh`, or other tools expect a `.git` directory.
42+
43+
A non-colocated workspace still stores most data in Git format, but the Git repository is hidden under `.jj`. Git tools do not see a `.git` directory at the workspace root, and you must run **jj git import** / **jj git export** yourself to keep Git refs in sync.
44+
45+
**enable** automates moving the store from `.jj/repo/store/git` to `.git` and pointing Jujutsu at it. **disable** reverses that. The command only works on a Git-backed workspace that Jujutsu itself manages; an external Git repo attached with **jj git init --git-repo** cannot be moved this way.
46+
47+
# CONFIGURATION
48+
49+
**git.colocate**
50+
> Default colocation for new repos created by **jj git init** and **jj git clone**. When **false**, those commands create a non-colocated workspace unless **--colocate** is passed.
51+
52+
# CAVEATS
53+
54+
Subcommand of **jj**. Requires the Git backend. Colocation makes Git tools work, but mixing mutating **git** and **jj** commands can produce bookmark conflicts or divergent change IDs (no data loss, but noisy). Automatic import on every command can slow down repos with a very large number of refs; **jj util gc** helps. Git tools see a non-human-readable representation of conflicted files inside the object store. Colocated workspaces are less resilient if the repo is shared over NFS or Dropbox.
55+
56+
# INSTALL
57+
58+
```pacman: sudo pacman -S jujutsu```
59+
60+
```apk: sudo apk add jujutsu```
61+
62+
```zypper: sudo zypper install jujutsu```
63+
64+
```brew: brew install jujutsu```
65+
66+
```nix: nix profile install nixpkgs#jujutsu```
67+
68+
<!-- packages: 2026-09-12 -->
69+
70+
# SEE ALSO
71+
72+
[jj-git](/man/jj-git)(1), [jj-git-init](/man/jj-git-init)(1), [jj-git-clone](/man/jj-git-clone)(1), [jj-git-import](/man/jj-git-import)(1), [jj-git-export](/man/jj-git-export)(1), [jj](/man/jj)(1)
73+
74+
# RESOURCES
75+
76+
```[Source code](https://github.com/jj-vcs/jj)```
77+
78+
```[Homepage](https://jj-vcs.github.io/jj/)```
79+
80+
```[Documentation](https://docs.jj-vcs.dev/latest/cli-reference/#jj-git-colocation)```
81+
82+
<!-- verified: 2026-09-13 -->

‎assets/commands/jj-git-export.md‎

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# TAGLINE
2+
3+
export Jujutsu bookmarks and tags into the backing Git repository
4+
5+
# TLDR
6+
7+
**Export** local Jujutsu refs into the underlying Git repo
8+
9+
```jj git export```
10+
11+
**Force an export** in a colocated workspace (skips the automatic no-op)
12+
13+
```jj git export --ignore-working-copy```
14+
15+
# SYNOPSIS
16+
17+
**jj git export** [_options_]
18+
19+
# PARAMETERS
20+
21+
**--ignore-working-copy**
22+
> Do not snapshot or update the working copy. In a colocated workspace, **jj git export** is otherwise a no-op because export already runs automatically; this flag forces an export.
23+
24+
**-h**, **--help**
25+
> Display help information.
26+
27+
# DESCRIPTION
28+
29+
**jj git export** writes Jujutsu bookmarks and tags into the backing Git repository as Git refs.
30+
31+
Jujutsu stores its own view of bookmarks separately from Git. Export copies that view into the Git store so **git** commands, Git hosting tools, and other consumers of `.git` see the same branch and tag tips. The reverse direction is **jj git import**.
32+
33+
In a **colocated** workspace (the default for **jj git init** / **jj git clone**), every **jj** command already imports and exports Git refs, so **jj git export** does nothing unless you pass **--ignore-working-copy**. In a **non-colocated** workspace the Git store is hidden under `.jj` and will stay stale until you export (and import) explicitly.
34+
35+
Use **jj git colocation status** to see which mode the workspace is in.
36+
37+
# CAVEATS
38+
39+
Subcommand of **jj**. Requires the Git backend. Export does not push to a remote; use **jj git push** for that. Refs that Git updated since the last import are not overwritten. Commits created by Jujutsu may carry extra Git ref prefixes under `refs/jj/` to keep them reachable for Git GC.
40+
41+
# INSTALL
42+
43+
```pacman: sudo pacman -S jujutsu```
44+
45+
```apk: sudo apk add jujutsu```
46+
47+
```zypper: sudo zypper install jujutsu```
48+
49+
```brew: brew install jujutsu```
50+
51+
```nix: nix profile install nixpkgs#jujutsu```
52+
53+
<!-- packages: 2026-09-12 -->
54+
55+
# SEE ALSO
56+
57+
[jj-git-import](/man/jj-git-import)(1), [jj-git-colocation](/man/jj-git-colocation)(1), [jj-git-push](/man/jj-git-push)(1), [jj-git](/man/jj-git)(1), [jj](/man/jj)(1)
58+
59+
# RESOURCES
60+
61+
```[Source code](https://github.com/jj-vcs/jj)```
62+
63+
```[Homepage](https://jj-vcs.github.io/jj/)```
64+
65+
```[Documentation](https://docs.jj-vcs.dev/latest/cli-reference/#jj-git-export)```
66+
67+
<!-- verified: 2026-09-13 -->

‎assets/commands/jj-git-import.md‎

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# TAGLINE
2+
3+
import Git refs from the backing repository into Jujutsu
4+
5+
# TLDR
6+
7+
**Import** Git branches and tags into the Jujutsu repo
8+
9+
```jj git import```
10+
11+
**Force an import** in a colocated workspace (skips the automatic no-op)
12+
13+
```jj git import --ignore-working-copy```
14+
15+
# SYNOPSIS
16+
17+
**jj git import** [_options_]
18+
19+
# PARAMETERS
20+
21+
**--ignore-working-copy**
22+
> Do not snapshot or update the working copy. In a colocated workspace, **jj git import** is otherwise a no-op because import already runs automatically; this flag forces an import.
23+
24+
**-h**, **--help**
25+
> Display help information.
26+
27+
# DESCRIPTION
28+
29+
**jj git import** updates the Jujutsu repository with changes made in the underlying Git repository.
30+
31+
It copies Git refs, compares them with the last imported state, and merges differences into local bookmarks and tags. The reverse direction is **jj git export**.
32+
33+
Commits that are no longer reachable from any branch in the Git repo are treated as abandoned there, and Jujutsu abandons them locally to match. If the working-copy commit is among them, it is replaced with a new empty commit (the same rule as **jj abandon** in general).
34+
35+
In a **colocated** workspace, every **jj** command already imports Git refs, so **jj git import** does nothing unless you pass **--ignore-working-copy**. In a **non-colocated** workspace (for example after **jj git init --git-repo** or **jj git colocation disable**), Git can change the backing store without Jujutsu noticing until you import.
36+
37+
# CONFIGURATION
38+
39+
**git.abandon-unreachable-commits**
40+
> When **false**, commits that disappeared from Git refs are not abandoned in the Jujutsu repo. Default is **true**.
41+
42+
# CAVEATS
43+
44+
Subcommand of **jj**. Requires the Git backend. Import does not fetch from a remote; use **jj git fetch** for that. Mixing mutating **git** and **jj** commands in a colocated workspace can produce bookmark conflicts or divergent change IDs. Git's index, unfinished rebases, and other in-progress Git states are ignored.
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-12 -->
59+
60+
# SEE ALSO
61+
62+
[jj-git-export](/man/jj-git-export)(1), [jj-git-fetch](/man/jj-git-fetch)(1), [jj-git-colocation](/man/jj-git-colocation)(1), [jj-git](/man/jj-git)(1), [jj](/man/jj)(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-git-import)```
71+
72+
<!-- verified: 2026-09-13 -->

‎assets/commands/jj-git-root.md‎

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# TAGLINE
2+
3+
print the path of the backing Git directory
4+
5+
# TLDR
6+
7+
**Print** the underlying Git directory
8+
9+
```jj git root```
10+
11+
Point **GitHub CLI** at a non-colocated repo
12+
13+
```GIT_DIR=$(jj git root) gh issue list```
14+
15+
Use the path as **GIT_DIR** for other Git-aware tools
16+
17+
```export GIT_DIR=$(jj git root)```
18+
19+
# SYNOPSIS
20+
21+
**jj git root** [_options_]
22+
23+
# PARAMETERS
24+
25+
**-R**, **--repository** _PATH_
26+
> Operate on the repository at _PATH_ instead of searching upward from the current directory.
27+
28+
**-h**, **--help**
29+
> Display help information.
30+
31+
# DESCRIPTION
32+
33+
**jj git root** prints the path of the underlying Git directory for a repository that uses the Git backend.
34+
35+
In a **colocated** workspace that is the workspace-root `.git` directory. In a **non-colocated** workspace the Git store is hidden under `.jj` (typically `.jj/repo/store/git`), so Git tools that look for `.git` in the working copy fail unless you set **GIT_DIR** to this path.
36+
37+
A common case is GitHub CLI (`gh`) in a non-colocated repo: `GIT_DIR=$(jj git root) gh issue list`. **direnv** users can put `export GIT_DIR=$(jj git root)` in `.envrc` so that happens automatically.
38+
39+
This is not the workspace root. For the directory that contains the working copy, use **jj workspace root** (or **jj root**).
40+
41+
# CAVEATS
42+
43+
Subcommand of **jj**. Requires the Git backend; it errors on a non-Git repository. The printed path may be a `.git` file (a gitdir pointer) rather than a directory in some layouts.
44+
45+
# INSTALL
46+
47+
```pacman: sudo pacman -S jujutsu```
48+
49+
```apk: sudo apk add jujutsu```
50+
51+
```zypper: sudo zypper install jujutsu```
52+
53+
```brew: brew install jujutsu```
54+
55+
```nix: nix profile install nixpkgs#jujutsu```
56+
57+
<!-- packages: 2026-09-12 -->
58+
59+
# SEE ALSO
60+
61+
[jj-git](/man/jj-git)(1), [jj-git-colocation](/man/jj-git-colocation)(1), [jj](/man/jj)(1), [git-rev-parse](/man/git-rev-parse)(1)
62+
63+
# RESOURCES
64+
65+
```[Source code](https://github.com/jj-vcs/jj)```
66+
67+
```[Homepage](https://jj-vcs.github.io/jj/)```
68+
69+
```[Documentation](https://docs.jj-vcs.dev/latest/cli-reference/#jj-git-root)```
70+
71+
<!-- verified: 2026-09-13 -->

‎assets/commands/jj-git.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,4 @@ Subcommand of jj. Requires Git backend. Some Git workflows (e.g., staging area)
9494

9595
# SEE ALSO
9696

97-
[jj](/man/jj)(1), [jj-git-push](/man/jj-git-push)(1), [jj-git-clone](/man/jj-git-clone)(1), [git](/man/git)(1)
97+
[jj](/man/jj)(1), [jj-git-clone](/man/jj-git-clone)(1), [jj-git-colocation](/man/jj-git-colocation)(1), [jj-git-import](/man/jj-git-import)(1), [jj-git-export](/man/jj-git-export)(1), [jj-git-root](/man/jj-git-root)(1), [jj-git-push](/man/jj-git-push)(1), [git](/man/git)(1)

0 commit comments

Comments
 (0)