Reputation: 131
I would like to work on two separate branches in my idea project.
An easy solution would be:
Clone the git directory (a second time) in my project folder and checkout the git required branch. This is not working in idea, the git copy does is not recognized as git folder.
The repository is not in project root, current structure:
ProjectFolder/
ProjectFolder/gitRepository
ProjectFolder/gitRepositoryClone
Upvotes: 2
Views: 4148
Reputation: 1323753
First, don't forget git worktree
(presented here) is not a second clone, but a copy of the working tree, on a different branch, for the same initial repository.
Second, from this thread, one way is:
I have created a worktree from command line next to the main work tree / folder and imported it as a second module
So do create it next to, not inside, your project folder, then import it.
And:
Does it make sense to keep a separate project for each worktree
I believe this is the right thing to do while putting worktree to the same project is not.
Checking out worktree inside your project folder is kind of duplicating the source code, and the use-case, in general, is not clear, unless there is some very specific setup.E.g. in IntelliJ project we do use worktrees, and they are usually checked out in a separate folder and opened as a separate project.
Upvotes: 4