Initialize configurations
This commit is contained in:
Executable
+71
@@ -0,0 +1,71 @@
|
||||
# Git
|
||||
|
||||
alias c="git commit -m"
|
||||
alias s="git status"
|
||||
alias gtagl="git fetch --tags && git tag -l -n9 --sort=-v:refname"
|
||||
alias d="git diff"
|
||||
alias d-s="git diff --staged"
|
||||
alias a="git add"
|
||||
alias n="git checkout -b"
|
||||
alias m="git merge --no-ff"
|
||||
alias gitSquash="git rebase --root -i"
|
||||
|
||||
gtag() {
|
||||
git tag -a $1 -m "$2"
|
||||
}
|
||||
|
||||
gtagReplace() {
|
||||
local msg
|
||||
msg=$(git tag -l -n9 $1 | sed "s/$1\s\+//g")
|
||||
git tag -d $1 && \
|
||||
git push origin :refs/tags/$1 && \
|
||||
git tag -a $1 -m "${msg}" && \
|
||||
git push origin $1
|
||||
}
|
||||
|
||||
gtagRemoveMinor() {
|
||||
if [[ $1 = "" ]]; then
|
||||
echo "How does the tag begin?"
|
||||
fi
|
||||
|
||||
local remove
|
||||
|
||||
local tags=$(git tag -l | grep "^${1}\.")
|
||||
|
||||
echo "${tags}"
|
||||
|
||||
echo -n "Remove these tags? (y/n) "
|
||||
|
||||
read remove
|
||||
|
||||
if [[ ${remove} != "y" ]] && [[ ${remove} != "yes" ]]; then
|
||||
echo "Ok then!"
|
||||
return 2
|
||||
fi
|
||||
|
||||
while read -r tag; do
|
||||
git tag -d ${tag}
|
||||
git push origin :refs/tags/${tag}
|
||||
done <<< "${tags}"
|
||||
}
|
||||
|
||||
gdiff() {
|
||||
local awkFormat='{ $2=on $2 off }; 1'
|
||||
local masterDiff=$(git cherry -v develop master | awk -v on="\033[31;33m" -v off="\033[0m" ${awkFormat})
|
||||
local develDiff=$(git cherry -v master develop | awk -v on="\033[31;33m" -v off="\033[0m" ${awkFormat})
|
||||
|
||||
if [[ "${masterDiff}" != "" ]]; then
|
||||
echo "\033[1;31;32mOnly in master:\033[0m"
|
||||
echo
|
||||
echo "${masterDiff}"
|
||||
fi
|
||||
|
||||
if [[ "${develDiff}" != "" ]]; then
|
||||
echo "\033[1;31;33mOnly in develop:\033[0m"
|
||||
echo
|
||||
echo "${develDiff}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
alias gitRemoveMerged="git branch --merged origin/master | grep -v '* master' | xargs git branch -d"
|
||||
Reference in New Issue
Block a user