Remove more unused scripts

This commit is contained in:
2022-08-15 20:37:03 +08:00
parent 824fcee942
commit 4f8e48cea3
21 changed files with 22 additions and 179 deletions

39
bash/sources/31_git-utils Normal file
View File

@@ -0,0 +1,39 @@
#!/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>\""
}
function git-amend-author {
NAME=$( git config user.name )
EMAIL=$( git config user.email )
git commit --amend --no-edit --author "$NAME <$EMAIL>"
}
if [ ! -f "$HOME/.gitconfig" ]; then
cat << ___CONF___ > "$HOME/.gitconfig"
[alias]
la = log --graph --full-history --date-order --all --pretty=format:'%Cred%h%Creset %ad %C(bold blue)[%an]%Creset | %C(white)%s%Creset %C(yellow)%d%Creset' --date=relative
[color]
ui = auto
[core]
excludesfile = ~/gitignore
[push]
default = tracking
[credential]
helper = store
___CONF___
fi