79 lines
1.8 KiB
Bash
Executable File
79 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -u
|
|
|
|
ORIGIN=origin
|
|
UPSTREAM=$ORIGIN
|
|
MASTER=$UPSTREAM/master
|
|
|
|
if [[ $# > 0 && "$1" == "-dry" ]]; then
|
|
DRY=true
|
|
else
|
|
DRY=false
|
|
fi
|
|
|
|
function git_alias() {
|
|
name=$1
|
|
body="$2"
|
|
echo "git config --global alias.$name $body"
|
|
if [[ $DRY != "true" ]]; then
|
|
git config --global alias.$name "$body"
|
|
fi
|
|
}
|
|
|
|
git config --global core.editor vim
|
|
|
|
git_alias st status
|
|
|
|
git_alias br branch
|
|
git_alias brd 'branch -d'
|
|
git_alias brD 'branch -D'
|
|
git_alias wipe $'!sh -c \'git push $1 --delete $2\' -'
|
|
git_alias rename "branch -m"
|
|
git_alias brl "for-each-ref --sort=-committerdate refs/heads/ --format='%(committerdate:short) %(refname:short)'"
|
|
|
|
git_alias co checkout
|
|
git_alias cob "checkout -b"
|
|
git_alias sw switch
|
|
|
|
git_alias ci commit
|
|
git_alias cif "commit --fixup"
|
|
git_alias cia "commit --amend"
|
|
git_alias cian "commit --amend --no-edit -a"
|
|
git_alias cim "commit -m"
|
|
|
|
git_alias f fetch
|
|
git_alias fp "fetch -p"
|
|
git_alias fpa "fetch -p --all"
|
|
|
|
git_alias pu $'!sh -c \'git push origin $(git branch --show-current)\''
|
|
git_alias puf $'!sh -c \'git push -f origin $(git branch --show-current)\''
|
|
|
|
git_alias rb rebase
|
|
git_alias rbi "rebase -i --autosquash"
|
|
git_alias rbim "rebase -i --autosquash $MASTER"
|
|
git_alias rba "rebase --abort"
|
|
git_alias rbc "rebase --continue"
|
|
git_alias rbs "rebase --skip"
|
|
git_alias rbm "rebase $MASTER"
|
|
|
|
git_alias unstage "reset HEAD --"
|
|
git_alias undo "reset --soft HEAD^"
|
|
|
|
git_alias ls "log --oneline"
|
|
git_alias slog "log --stat"
|
|
git_alias dlog "log --patch"
|
|
git_alias plog "log --patch"
|
|
git_alias lola "log --graph --decorate --pretty=oneline --abbrev-commit --all --date=local"
|
|
|
|
git_alias sh stash
|
|
git_alias shs "stash save"
|
|
git_alias shl "stash list"
|
|
git_alias sha "stash apply"
|
|
git_alias shp "stash pop"
|
|
git_alias shd "stash drop"
|
|
|
|
git_alias aliases "config --get-regexp alias"
|
|
git_alias configs "config --list"
|
|
|