-
Notifications
You must be signed in to change notification settings - Fork 0
/
_git_aliases.zsh
35 lines (35 loc) · 1.5 KB
/
_git_aliases.zsh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
function g { if [[ $# > 0 ]]; then git $@; else git status; fi; }
alias ghw="gh repo view --web --branch=\"\$(git branch --show-current)\""
alias ghpr="gh pr create"
alias gs="git show"
alias gst="git stash"
alias gd="git difftool"
alias gdd="git diff"
alias gf="git fetch"
alias gr="git rebase"
alias gri="git rebase -i"
alias gp="git pull --rebase && gbm"
alias gl="git log"
alias glp="git log -p"
alias ga="git add"
alias gap="git add -p"
alias gb="git branch"
alias gbm="git branch --merged | grep -v '^[\* ] \(main\|develop\|master\)$' | sed -E 's/^[[:space:]\*]+//g' | xargs | sed 's/^/git branch -d /'"
alias gc="git commit"
alias gco="git checkout"
alias gcob="git checkout -b"
alias gcod="git checkout develop"
alias gcom="git checkout main"
alias gt="git tag"
alias gcp="git cherry-pick"
alias gpush="git push"
alias gpushf="git push --force-with-lease"
alias grod="git fetch -q origin && git checkout develop && git rebase origin/develop && git checkout - && git rebase develop"
alias grodi="git fetch -q origin && git checkout develop && git rebase origin/develop && git checkout - && git rebase -i develop"
alias grom="git fetch -q origin && git checkout main && git rebase origin/main && git checkout - && git rebase main"
alias gromi="git fetch -q origin && git checkout main && git rebase origin/main && git checkout - && git rebase -i main"
alias gam="git commit --amend --no-edit"
function gto {
bare=$(echo $1 | sed 's/origin\///')
git fetch -q origin && git branch --track $bare origin/$bare && git checkout $bare
}