Useful shell script tips for prime #1239
Replies: 1 comment
-
See your current branchTo show your current branch name in your prompt ( git_branch() {
git branch 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | sed "s/$/ /" | sed "s/^/ /"
}
# Key item here is the call to the git_branch function at the end
# Feel free to fiddle with the colors
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$(git_branch)\$ ' Note that this is evaluated every time the git show-identitygit-show-identity.gz #!/usr/bin/env bash
NORMAL="\e[0m"
WHITE="\e[1;97m"
echo "Git Identity:"
echo -e " Name: ${WHITE?}$(git config --get user.name)${NORMAL?}"
echo -e " E-Mail: ${WHITE?}$(git config --get user.email)${NORMAL?}"
echo -e " Signing Key: ${WHITE?}$(git config --get user.signingKey)${NORMAL?}" Invoke with git show-identity # note: no git- git identifygit-identify.gz usage: git identify [optional gpg-e-mail-address-here] When no argument is given to identify, then it will prompt you for your GPG identity |
Beta Was this translation helpful? Give feedback.
-
So over time working on Prime I've been adding aliases and zsh functions, and I wanted to share them here. Please do the same. Note - I use Zsh, so you might need to edit these slightly for your specific shell.
Aliases
Functions
Beta Was this translation helpful? Give feedback.
All reactions