Linux – Adding Git repo and branch to Tmux status line

bashcommand linegitlinuxtmux

I have found a Tmux configuration file that shows how to add the Git branch to the Tmux status line, however It just shows [[ branch ]] no matter if I am in a Git repo or not. I am not sure if this requires git-completion, but if so I'm not even sure if it is installed as it is a 'virtual' package in Ubuntu (the leading 'v' means 'virtual'):

$ aptitude search git-completion
v   git-completion

$ sudo apt-get install git-completion
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'git' instead of 'git-completion'
git is already the newest version.

How might I add the branch and also the git repo name for the CWD to the Tmux status line?

Thanks.

Best Answer

I developed a Bash script for doing that: tmux-git.

tmux-git shows the Git branch of the current working directory, and also checks for uncommited and stashed changes.

Related Question