6

Our git workflow looks like it is shown in the picture. There is a master branch for the releases. Development takes place in the develop branch respectively in feature branches. I connected my IntelliJ (version 13.4.1) to our ticket system (redmine). So when I open a task, IntelliJ automatically creates a feature branch for me.

When I switch back to the Default Task, IntelliJ checks out the master branch. However in most cases I want to have the develop branch checked out, and I have to switch manually. How do I configure IngelliJ (or git) to check out the develop brach each time I open the Default Task?

enter image description here

Marc Hauptmann
  • 688
  • 5
  • 18

4 Answers4

18

I've found that you can change which branch is associated with a task by editing the .idea/workspace.xml file in your project. Find the task element with an id of Default. There should be a child branch element. Change its name to the name of the branch that you want tied to the task. So in your case, you should be changing master to develop.

kcintrab
  • 386
  • 3
  • 5
13

This works for Android Studio, so I guess it works for vanilla IntelliJ too.

Select the Default Task, then go to the Tools menu, then "Tasks & Contexts". Then you will have an option called Edit 'Default Task', there you can change the default branch for the task.

This also works for other tasks.

mikehc
  • 999
  • 8
  • 22
0

According to IntelliJ support, the default task is hard wired to the master branch.

However, I think this is not accurate as I have one project in which I end up on a former feature branch whenever I switch to the default task. This seems to be a bug and I have no idea how the former feature branch got linked to the default task and there seems to be no way to unlink the two.

I you want to be able to assign a branch to your default tasks, you can vote for this feature here: https://youtrack.jetbrains.com/issue/IDEA-130783

0

I've found that you can change which branch is associated with a task by editing the .idea/workspace.xml file in your project. Find the task element with an id of Default. There should be a child branch element. Change its name to the name of the branch that you want tied to the task. So in your case, you should be changing master to develop.

You may also set the "start.from.branch" property otherwise you will start your furtures branches from master.

<property name="start.from.branch" value="develop" />
Karbos 538
  • 2,977
  • 1
  • 23
  • 34