---
title: "Terminal improvements for git"
slug: terminal-improvements-for-git
section: tech
date: 2015-05-22T15:38:00.000Z
canonical: https://roland.leth.ro/blog/tech/terminal-improvements-for-git
---

*Improvement #1*: adding the current branch name after the current path. Add this in your `.bash_profile` file:

```bash
parse_git_branch() {
    git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}

export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
export PS1='\[\e[0;32m\]\u\[\e[0m\]:\[\e[0;33m\]\w\[\e[0m\]\[\e[0;35m\]$(parse_git_branch)\[\e[0m\]$ '
```

And the outcome is `user:path (branch_name) $ `. The `user` is green, the `path` is yellow, the `branch_name` is purple and everything else is white.

*Improvement #2*: autocompletion for branch names. Again, add this in your `.bash_profile` file:

```bash
if [ -f ~/.git-completion.bash ]; then
  . ~/.git-completion.bash
fi
```

I find these pretty useful. Actually, I find them indispensable after a prolonged use. Don't forget to tweak the colors to your own preferences.