Search code examples
gitintellij-ideagit-worktree

How do I use git worktrees in IntelliJ IDEA 2016.1?


The newest version of IntelliJ says it has support for git worktrees, but I can't seem to find anywhere that says how to use it. I was expecting to see an entry in the Git Branches popup in the lower right, but I don't see it there.

I also don't see any descriptions in:
Blog post announcing the feature
What's new video

IntelliJ help and googling were also unhelpful

I'm using Git version 2.7.2.0, worktrees were introduced in 2.5


Solution

  • As far as I can tell, "support" means that when you open a worktree in IntelliJ, all the VCS functions work properly. Based on the comments in the Youtrack link provided by max630, you could not view diffs, view history, or commit changes before 2016.1.

    With 2016.1, however, you can open the worktree as a new project and perform all VCS operations via IntelliJ.

    It would be nice to have project settings shared for those of us that .gitignore them, but that does not appear to be supported currently.

    I have been using the following workflow recently with success:

    1. git worktree add ../hotfix hotfix/1.2.3
    2. File -> Open in IntelliJ
    3. Manually copy all Run Configurations over to the new .idea directory (if necessary)