Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

showing git branch in path for linux

#202

on the following page:

http://infinitas.lighthouseapp.com/projects/43419/using-git-with-infinitas

you mention that the terminal path shows the branch in the path in windows, and yes that is windows only. But to add this ability in linux you can edit your ~/.bashrc file with the following:

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

export PS1='\[\033[0;35m\]\h\[\033[0;33m\] \w\[\033[00m\] $(parse_git_branch)$ '

the parse_git_branch function will pull the current projects branch name. the export line will add the branch name to the end of the path. For example, my path looks like so:

shamce /var/www/sites/shamce.net/shamce (dev) $
^computer name
shamce /var/www/sites/shamce.net/shamce (dev) $
-------^ path
shamce /var/www/sites/shamce.net/shamce (dev) $
-----------------------------------------^ branch

the export line will also colorize the path to make it more readable.

Reported by luckysmack · May 19th, 2010 @ 06:52 AM

State: invalid
Milestone: none
Assigned to: nobody

Activity

  1. dogmatic69
    dogmatic69
    • State changed from new to invalid

    July 6th, 2013 @ 02:18 AM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.