17 lines
307 B
Plaintext
17 lines
307 B
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
function git-config-as {
|
||
|
local SHA NAME EMAIL
|
||
|
SHA=$1
|
||
|
if [ -z "$1" ]; then
|
||
|
SHA=HEAD
|
||
|
fi
|
||
|
NAME=$( git log $SHA -1 --pretty=format:%aN )
|
||
|
EMAIL=$( git log $SHA -1 --pretty=format:%ae )
|
||
|
|
||
|
git config user.name "$NAME"
|
||
|
git config user.email "$EMAIL"
|
||
|
echo "Configured as \"$NAME <$EMAIL>\""
|
||
|
}
|
||
|
|