initial commit

This commit is contained in:
Lander Van den Bulcke 2024-08-26 09:53:25 +00:00 committed by Lander Van den Bulcke
commit e887d8bc7d
Signed by: lander
GPG key ID: 0142722B4B0C536F
13 changed files with 490 additions and 0 deletions

View file

@ -0,0 +1,16 @@
#!/usr/bin/env bash
# get each set of usernames from the git config
IDENTITIES=$(git config --global --name-only --get-regexp "user.*..name" | sed -e 's/^user.//' -e 's/.name$//')
# filter them with fzf
ID=$(echo "${IDENTITIES}" | fzf -e -1 +m -q "$1")
if ! git config --global --get-regexp "user.${ID}.name" > /dev/null; then
echo "Please use a valid git identity
Options:"
git config --global --name-only --get-regexp "user.*..name" | sed -e 's/^user.//' -e 's/.name$//' -e 's/^/\t/'
exit 1
fi
# set the id locally in each repo (eg in the repo's .git/config)
git config user.name "$(git config user.${ID}.name)"
git config user.email "$(git config user.${ID}.email)"