docs/git-compatibility.md: preserve working copy files when co-locating

Use `jj new && jj undo` instead of `jj new @-` at the end of converting to a
co-located repository, because the latter "stashes" newly added working copy
changes into a sibling commit.

See also: https://github.com/martinvonz/jj/discussions/4945

Signed-off-by: Tim Janik <timj@gnu.org>
This commit is contained in:
Tim Janik 2024-11-22 15:34:08 +01:00
parent d5bf1489e4
commit 86a2a2b1e9

View file

@ -174,15 +174,16 @@ technically possible (though not officially supported) to convert it into a
co-located repo like so:
```bash
# Ignore the .jj directory in Git
echo '/*' > .jj/.gitignore
# Move the Git repo
mv .jj/repo/store/git .git
# Tell jj where to find it
echo -n '../../../.git' > .jj/repo/store/git_target
# Ignore the .jj directory in Git
echo '/*' > .jj/.gitignore
# Make the Git repository non-bare and set HEAD
git config --unset core.bare
jj new @-
# Convince jj to update .git/HEAD to point to the working-copy commit's parent
jj new && jj undo
```
We may officially support this in the future. If you try this, we would