Follow

I want to try to have my shell prompt include details on the current repo.

Feel free to send my your suggestions, or scripts!

@ebel So #ZSH is not a option? Just use a theme that includes git state ohmyz.sh

@blub eeeeeehheheh. I've been using bash since forever.... Changing shell just seems like much too much work.

@ebel Well I see your point, but IMHO it has no cons. Use it since a few years and makes me happy to deal with servers, git repos, pyenv, ... and a lot of cmds and cli apps.

@blub in theory I often ssh into different machines which won't have that installed. But in those cases I don't have my bashrc installed either.... πŸ€”

@ebel Not git-specific, but I use (shortened):

PROMPT_COMMAND='
if test -f .dist; then
{
read NEW_DIST 2>/dev/null
read NEW_UPLOAD 2>/dev/null
} < .dist
if test "$DIST" != "$NEW_DIST"; then
echo "Changing DIST: *$NEW_DIST*"
DIST="$NEW_DIST"
export DIST
unset NEW_DIST
fi
fi
'

I have a file called ".dist" in my repos to automatically switch some build options when I "cd" there.

@ebel I'm happy with the default of sticking $(__git_ps1) somewhere in my prompt. Other people add more bling, but this seems enough for me. (I do most git commands from Emacs/Magit, so the shell prompt is basically "current branch and is anything modified/staged".)

Sign in to participate in the conversation
⛧ MOYTURA ⛧

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!