From b9cdbf8cbd3935205e2180a530cb9e03a81f7475 Mon Sep 17 00:00:00 2001 From: gpkvt Date: Mon, 17 Jul 2023 06:16:30 +0200 Subject: [PATCH] Added git aliases --- zsh/aliases.zsh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 40d81e9..051809a 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -77,6 +77,38 @@ alias drun=drun-fn alias dsp="docker system prune --all" alias dsr=dsr-fn +function current_branch() { + ref=$(git symbolic-ref HEAD 2> /dev/null) || return + echo ${ref#refs/heads/} +} + +function current_repository() { + + ref=$(git symbolic-ref HEAD 2> /dev/null) || return + echo $(git remote -v | cut -d':' -f 2) +} + +alias g='git' +alias gst='git status' +alias gup='git fetch && git rebase' +alias gc='git commit -a -v' +alias gco='git checkout' +alias gcm='git checkout master' +alias gb='git branch' +alias gba='git branch -a' +alias gcount='git shortlog -sn' +alias gcp='git cherry-pick' +alias glg='git log --stat --max-count=5' +alias glgg='git log --graph --max-count=5' +alias gss='git status -s' +alias ga='git add -A' +alias gm='git merge' +alias grh='git reset HEAD' +alias grhh='git reset HEAD --hard' +alias gl='git pull origin $(current_branch)' +alias gp='git push origin $(current_branch)' +alias gpnp='git pull origin $(current_branch) && git push origin $(current_branch)' + alias ls='ls --color=never' alias ll='ls -lah --color=never' alias grep='grep --color=auto'