Archive for the ‘Bash’ Category

Please never run this

Came across this and thought it was amusing.
(more…)

Git Status in your Prompt

Came across a cool little Bash snippet today. Putting this in your .bashrc or .bash_profile files will – if your current directory is part of a git repository – show you your current branch and whether there are any uncommitted changes.

Note that the PS1 syntax used here is Debian-based (ie. Ubuntu). Other distros should use their own syntax.

UPDATE: changed it to append to PS1 instead of overwriting it, making it more cross-platform(-ish).