views:

25

answers:

2

I've recently moved from Eclipse to IntelliJ. A challenge as I'm a keyboard shortcut junkie, but that isn't what I'm here about.

I miss having the git branch name shown in the package/project view.

Does anyone know of a way to configure IntelliJ to display what git branch the project is in, so I don't have to keep switching back to the terminal and checking.

Thanks.

+1  A: 

That setting doesn't seem to be available with the current Git integration in IntelliJ IDEA.

One workaround would be to start a fake push, because the push Window would then display the current branch.

alt text

(just click cancel instead of going forward with the push:
You have the information you were looking for in the first place.)

VonC
A: 

As IntelliJ cannot show be my branch I found a way to add the branch to my bash prompt in the terminal. I've added this to my .bashrc file and I get a nice real-time branch indicator.

#Git branch prompt
function parse_git_branch {
  git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}

function proml {
  local        BLUE="\[\033[0;34m\]"
  local         RED="\[\033[0;31m\]"
  local   LIGHT_RED="\[\033[1;31m\]"
  local       GREEN="\[\033[0;32m\]"
  local LIGHT_GREEN="\[\033[1;32m\]"
  local       WHITE="\[\033[1;37m\]"
  local  LIGHT_GRAY="\[\033[0;37m\]"
  case $TERM in
    xterm*)
    TITLEBAR='\[\033]0;\u@\h:\w\007\]'
    ;;
    *)
    TITLEBAR=""
    ;;
  esac

PS1="${TITLEBAR}$RED\u@\h:\w$GREEN\$(parse_git_branch)$LIGHT_GRAY\$ "
PS2='> '
PS4='+ '
}
proml
dom farr
Does this one update when you switch branches from the command line?
Casey Watson
yes. if you are in a directory that is tracked by git then the prompt includes the current branch.
dom farr