IntelliJ - GIT delete local orphan branch in GUI -


i use intellij (2016.1.3) , git integration plugin (8.1). during use of intellij checked out multiple branches. branches deleted git (after each pull request delete them).

from on every branch checked out once present in git view intellij (by vcs > git > branches...), see under :

enter image description here

there way delete them : ... one one ! if there lot of branches (let hundred ...), getting tedious...

the question : know if there simple way delete orphan local branches view in intellij ?

thanks :)

edit : have found way delete them in tool : "git gui". when delete there, it's deleted in intellij too. , can delete multiple branches @ 1 time.

remote tracking branches confused normal git branches. remote tracking branch begins remotes/, in remotes/origin/branch1, although git allows omit remotes/ shorthand, can refer remotes/origin/branch1 origin/branch1. these not normal branches. can't commit them or check them out directly. if try check them out, git either check out detached head or automatically create new local branch same name remote branch, e.g. branch1. new local branch never deleted unless tell git delete explicitly.

what happening twofold:

  1. you need make sure git pruning remote tracking branches (remotes/origin/branch1, etc.). default not. see this question on pruning remote tracking branches how this. it's git fetch -p origin or git remote prune origin.

  2. when checked out branch work on it, created local branch same name remote tracking branch. local branch branch1 never deleted unless manually, if remote tracking branch remotes/origin/branch1 pruned, done if branch1 deleted on remote server.

you can clean these branches manually git branch -d (or force -d, may necessary if branch never merged), or @ answers remove old remote branches git automated way it.


Comments