From 2fb628a68a4e6e3e026f550473f42caea6e43dda Mon Sep 17 00:00:00 2001 From: hophacker Date: Mon, 14 Mar 2022 09:36:30 +0800 Subject: [PATCH] feat: git_rebase_to_origin, git_rm_tag_of_remote, git_log_history --- zsh/git.zsh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/zsh/git.zsh b/zsh/git.zsh index 8125bd7..1b53725 100644 --- a/zsh/git.zsh +++ b/zsh/git.zsh @@ -6,3 +6,20 @@ alias gfR='gf origin master; gwR origin/master' alias gpb='git push origin "$(git-branch-current 2> /dev/null):build"' alias gitUserRallet="git config user.name rallets;git config user.email rallet@rallets.com" alias gfs="gs;gfr;gsp" +git_rebase_to_origin() { + BRANCH=${1:-master} + DIRTY=false + git fetch origin + [[ -n $(git status -s) ]] && DIRTY=true + $DIRTY && echo "Git is dirty" + $DIRTY && (git add .; git stash) + git rebase origin/$BRANCH + $DIRTY && (git stash pop; git reset HEAD) +} +git_rm_tag_of_remote() { + TAG=$1 + REMOTE=${2:-origin} + git tag -d $TAG + git push --delete $REMOTE $TAG +} +git_log_history='git log -p --'