# Git - Show Branch Name on Terminal

How can we show branch name anytime we’re running terminal on git directory (Linux). It make your steps easier without always typing **git branch** anytime you’d like to know on what branch you are in.

# **Configuration**

## **1\. Open ~/.bashrc**

Open your **~/.bashrc** on your favourite text editor.

## **2\. Paste Configuration Code**

Next you need to paste this code at the of the *~/.bashrc* file:

```bash
git_branch() {
  git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}export PS1="\e[1m\e[32m\u@\h\e[0m\e[0m:\e[1m\e[34m\w\e[0m\e[1;33m\$(git_branch)\e[0m\$ "
```

## **3\. Custom Color**

If you would like to use another color, you can go to this link to learn more: [https://www.shellhacks.com/bash-colors/](https://s.id/1GOPT)

## **4\. Apply Configuration**

Apply your configuration without you having to logout/login by execute this command:

```bash
$ source ~/.bashrc
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681195041042/79ce3c24-c785-4369-a10b-ad2325a3ffb1.webp align="center")

**— FINISHED —**
