Workflow for multiple SVN branches in IntelliJ IDE

2020-07-09 10:16发布

问题:

I'd like to easily switch between SVN trunk and one or a few feature branches using IntelliJ IDEA, preferably being able to work on multiple branches concurrently. I have some "local" configuration like database settings for integration tests and debug-logging enabled that I'd like to keep using and not commit to SVN.

What are the pros and cons of the various options, is there one way which easily beats the others? Here are some possible approaches I can think of, any more?:

  • Using the "SVN - Update Directory" to swap out the current branch for another.
    Won't allow working on multiple branches concurrently.

  • Creating a module per branch in a single project.
    Seems to cause issues with clicking on stacktraces/class names going to the wrong module, easily accidentally search across modules by accident and such?

  • Creating a separate IntelliJ project per branch.
    More redundant with separate settings per project, more work to keep everything in sync between the projects. Less risk of accidentally working with the wrong branch.

回答1:

I have the best experience with

Creating a separate IntelliJ project per branch

Pros

  • Very quick switch between branches.
  • You can have open more branches in same time.

Cons

  • You have to setup idea project for every branch.
  • Usable only for limited count of branches.

I have one project for trunk version and other project for current production version. When you have more branches then two, first option is better idea I think.



回答2:

There is one feature keeping the "Creating a (or multiple < all modules) module per branch in a single project" approach from being more viable than the other.

There is a forum post at jetbrains discussing the worth of this feature. Maybe this feature can get raised by the community itself requesting for it.

The request is for a "label decoration configuration" in the project view. I'm still searching an issue in youtrack dashboard to vote for this feature. Maybe I'll add one in the future.