first time poster.
This came up in conversation at work this week…
Is there a way, when you connect to git remotely that you can get display current working directory/current git repo/branch in your terminal prompt?
Apparently, there are linux/vim scripts that exist for linux users, and I’d like to add this sort of shell script to my profile.
Currently I’m using some info from this page http://sos.blog-city.com/mac_os_x__bash_customize_your_terminal_prompt_a_little_color.htm to address some of this info locally.
Thanks in advance.
Get a copy of the git completion script. You can get this from git itself, or if you have a Linux box handy you could even just copy it from there (it’ll probably be
/etc/bash_completion.d/git). Then, arrange for this to get “sourced” by bash. You can do this by adding something like this to your.bashrc:(assuming you named the file
/usr/local/git-completionon your Mac).Finally, you’ll want to adjust your prompt. Also in your
.bashrc, add something like:Here’s a blog post (not by me) that talks about this (and some other related stuff) in more detail: http://blog.bitfluent.com/post/27983389/git-utilities-you-cant-live-without