Added git-utils
This commit is contained in:
parent
b10b68aa3b
commit
b420add084
@ -1,17 +1,9 @@
|
||||
#!/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 sanitize-perms {
|
||||
chown $USER.$USER . -R
|
||||
find . -type d -exec chmod 755 {}\;
|
||||
find . -type f -exec chmod 644 {}\;
|
||||
}
|
||||
|
||||
# Kubernetes
|
||||
|
12
bash/bashrc/sources/21_win-greps
Executable file
12
bash/bashrc/sources/21_win-greps
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
function grepo {
|
||||
grep --color=always "$1" . -r | awk '{ count++; print " ["count"] "$0 } '
|
||||
echo -n "Select number to open: "
|
||||
read num
|
||||
|
||||
IFS="
|
||||
"
|
||||
CHOICES=( `grep -n "$1" . -r | awk 'BEGIN{ FS=":" }{ print "notepad /g "$2" "$1 }'` )
|
||||
bash -c ${CHOICES[$(( num - 1 ))]}
|
||||
}
|
32
bash/bashrc/sources/31_git-utils
Normal file
32
bash/bashrc/sources/31_git-utils
Normal file
@ -0,0 +1,32 @@
|
||||
#!/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>\""
|
||||
}
|
||||
|
||||
|
||||
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
|
Loading…
Reference in New Issue
Block a user