Description
I was just in the situation to convert an existing Git repo into a Jujutsu repo. However, I struggled to find how I should do that.
$ cd path/to/git-repo
$ ls
.git/
foo.txt
...
$ jj ????
jj git --help, jj git init --help failed to give any suitable hints. I've found the --git-repo argument but its description looked more like what to use when the repo directory does not contain the .git/ folder, i.e. the .git/ folder is somewhere else on the filesystem. At one point I briefly considered jj git clone and clone the repo to convert it since this is found everywhere when looking for "using Jujutsu with Git".
Since in this case the Git repo in question was a disposable sandbox repo, where data loss was irrelevant, I decided to try my luck with jj git init.
$ jj git init
Done importing changes from the underlying Git repo.
Initialized repo in "."
Hint: Running `git clean -xdf` will remove `.jj/`!
I believe this worked, though I've only tested basic functionality. Is that the intended way of achieving this or should jj git init --git-repo=. be used?
Expected Behavior
I wish Jujutsu would be more clear how to convert an existing Git repo to a (colocated) Jujutsu repo.
A hint somewhere in jj git init --help, e.g. a sentence like
If the destination directory already contains a .git/ folder, then Jujutsu uses it as the backing git repo for the newly created jj repo, effectively converting the Git repo into a colocated Jujutsu repo.
or
If the destination directory already contains a .git/ folder, then use --git-repo=$DESTINATION to convert it into a colocated Jujutsu repo.
or
--git-repo
[....]
Pass $DESTINATION to convert an existing Git repo into a colocated Jujutsu repo.
whatever is the correct way of doing this. (Feel free to use these sentences as you wish.)
I've also looked through the documentation on https://www.jj-vcs.dev but couldn't find there anything either.
So additionally, it could be mentioned there, e.g. under FAQ and possibly also under the Tutorial
For the FAQ:
Q: How to convert an existing Git repo into a Jujutsu repo?
A1: Run jj git WHATEVER IS CORRECT /path/to/git/repo.
(could potentially elaborate that .git/ is not part of the path)
For the Tutorial:
(after jj git clone code block)
Alternatively, you can convert an existing Git repository into a Jujutsu repository by running
$ cd path/to/my-git-repo
$ jj git WHATEVER IS CORRECT
Description
I was just in the situation to convert an existing Git repo into a Jujutsu repo. However, I struggled to find how I should do that.
jj git --help,jj git init --helpfailed to give any suitable hints. I've found the--git-repoargument but its description looked more like what to use when the repo directory does not contain the.git/folder, i.e. the.git/folder is somewhere else on the filesystem. At one point I briefly consideredjj git cloneand clone the repo to convert it since this is found everywhere when looking for "using Jujutsu with Git".Since in this case the Git repo in question was a disposable sandbox repo, where data loss was irrelevant, I decided to try my luck with
jj git init.I believe this worked, though I've only tested basic functionality. Is that the intended way of achieving this or should
jj git init --git-repo=.be used?Expected Behavior
I wish Jujutsu would be more clear how to convert an existing Git repo to a (colocated) Jujutsu repo.
A hint somewhere in
jj git init --help, e.g. a sentence likeor
or
whatever is the correct way of doing this. (Feel free to use these sentences as you wish.)
I've also looked through the documentation on https://www.jj-vcs.dev but couldn't find there anything either.
So additionally, it could be mentioned there, e.g. under FAQ and possibly also under the Tutorial
For the FAQ:
For the Tutorial: