IntelliJ and Git Branch Name
GitIntellij IdeaGit Problem Overview
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.
Git Solutions
Solution 1 - Git
As of IntelliJ 11 the current Git branch is displayed in the bottom right corner of the status bar. Moreover, clicking on the branch name displays a nice popup with all available branches, and you can invoke some actions on them.
To enable status bar
follow the below steps :
View --> Appearance --> Status Bar [and click to enable/disable]
Solution 2 - Git
Solution 3 - Git
Firstly, if your entire status bar is hidden or not display currently; So, you can enable it by easily by Tick the Status Bar option like this:
View -> Appreances -> Then Tick the Status Bar option
If your problem is still displaying the Status Bar in the IDE though, your GIT branch section doesn't display. Then you can use Status Bar Widget option to enable it also.
View -> Appreances -> Ststus Bar Widgets -> Git Branch
Hope this will fix your issue.
Solution 4 - Git
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
EDIT: Ignore this prompt. If you need a GIT prompt use http://volnitsky.com/project/git-prompt/
Solution 5 - Git
Coming from Eclipse, I was used to that, so I created a plugin for this:
Solution 6 - Git
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.
(just click cancel instead of going forward with the push:
You have the information you were looking for in the first place.)
Solution 7 - Git
- You have to add VCS to the project if not already done
- CTRL SHIFT A - opens find
- Type - status
- Select Status Setting
- Click on version control
- It would list out the unregistered projects
- Select your project then click on + button on the right panel
- If You have initialized the git in your local then it would not ask for git path.
- Check the other parameters as per your requirement and then apply.
Congrats, you are done provided you have enabled the status bar.
Solution 8 - Git
This is a late answer, if someone is looking for a way to see current git branch in intelliJ.
- Install gitbar plugin Git Bar Plugin Repo
- Enable status bar and look at the bottom right corner , which shows your current branch as well as you can switch branches from there.
Solution 9 - Git
I had an issue whereby I had no git bar or indexing status after moving to IntelliJ 2017.2 - my issue was down to the 'Code Outline' plugin. I deleted it's jar file from C:\Users\[user]\.IntelliJIdea2017.2\config\plugins
restarted IntelliJ and I suddenly had my git branch info and indexing status back. Maybe this will help someone else...
Solution 10 - Git
Try using git.exe from "/bin" folder
Solution 11 - Git
Just install GitToolBox plugin.
Side note
The default behavior is to show the file full-path and it will be hard to see the branch names since they're pushed all the way to the right. To solve that you can:
- Go to
File > Settings > Other Settings > GitToolBoxGlobal > Project View
and arrange the ordering of the variables in the left pane. E.g. I use the following order: {status} {branch} {tags on head} {location}; this will display something like3↑ 2↓ master 1.0.0 /path/to/location
- Or install PathHide plugin to get rid the module path if you don't need it.