Forked from freewind/Git aliases for fish shell.fish
Last active
May 3, 2022 12:06
-
-
Save realkotob/10f7126d08bf626a16ac3154eccfe652 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Aliases | |
alias gg='git finish' | |
alias g='git' | |
alias gst='git status' | |
alias gd='git diff' | |
alias gdc='git diff --cached' | |
alias gl='git pull' | |
alias gup='git pull --rebase' | |
alias gp='git push' | |
alias gd='git diff' | |
function gdv | |
git diff -w $argv | view - | |
end | |
alias gcmsg='git commit -v' | |
alias gca='git commit -v -a' | |
alias gca!='git commit -v -a --amend' | |
alias gc='git commit -m' | |
alias gc!='git commit -v --amend' | |
alias gco='git checkout' | |
alias gcm='git checkout master' | |
alias gr='git remote' | |
alias grv='git remote -v' | |
alias grmv='git remote rename' | |
alias grrm='git remote remove' | |
alias grset='git remote set-url' | |
alias grup='git remote update' | |
alias grbi='git rebase -i' | |
alias grbc='git rebase --continue' | |
alias grba='git rebase --abort' | |
alias gb='git branch' | |
alias gba='git branch -a' | |
alias gcount='git shortlog -sn' | |
alias gcl='git config --list' | |
alias gcp='git cherry-pick' | |
alias glg='git log --stat --max-count=10' | |
alias glgg='git log --graph --max-count=10' | |
alias glgga='git log --graph --decorate --all' | |
alias glo='git log --oneline' | |
alias gss='git status -s' | |
alias ga='git add' | |
alias gm='git merge' | |
alias gwc='git whatchanged -p --abbrev-commit --pretty=medium' | |
#remove the gf alias | |
#alias gf='git ls-files | grep' | |
alias gpoat='git push origin --all; and git push origin --tags' | |
alias gmt='git mergetool --no-prompt' | |
alias gg='git gui citool' | |
alias gga='git gui citool --amend' | |
alias gk='gitk --all --branches' | |
alias gsts='git stash show --text' | |
alias gsta='git stash' | |
alias gstp='git stash pop' | |
alias gstd='git stash drop' | |
# Will cd into the top of the current repository | |
# or submodule. | |
alias grt='cd (git rev-parse --show-toplevel; or echo ".")' | |
# Git and svn mix | |
alias git-svn-dcommit-push='git svn dcommit; and git push github master:svntrunk' | |
alias gsr='git svn rebase' | |
alias gsd='git svn dcommit' | |
# | |
# Will return the current branch name | |
# Usage example: git pull origin $(current_branch) | |
# | |
function current_branch | |
set ref (git symbolic-ref HEAD 2> /dev/null); or \ | |
set ref (git rev-parse --short HEAD 2> /dev/null); or return | |
echo ref | sed s-refs/heads-- | |
end | |
function current_repository | |
set ref (git symbolic-ref HEAD 2> /dev/null); or \ | |
set ref (git rev-parse --short HEAD 2> /dev/null); or return | |
echo (git remote -v | cut -d':' -f 2) | |
end | |
# these aliases take advantage of the previous function | |
alias ggpull='git pull origin (current_branch)' | |
alias ggpur='git pull --rebase origin (current_branch)' | |
alias ggpush='git push origin (current_branch)' | |
alias ggpnp='git pull origin (current_branch); and git push origin (current_branch)' | |
# Pretty log messages | |
function _git_log_prettily | |
if ! [ -z $1 ]; then | |
git log --pretty=$1 | |
end | |
end | |
alias glp="_git_log_prettily" | |
# Work In Progress (wip) | |
# These features allow to pause a branch development and switch to another one (wip) | |
# When you want to go back to work, just unwip it | |
# | |
# This function return a warning if the current branch is a wip | |
function work_in_progress | |
if git log -n 1 | grep -q -c wip; then | |
echo "WIP!!" | |
end | |
end | |
# these alias commit and uncomit wip branches | |
alias gwip='git add -A; git ls-files --deleted -z | xargs -0 git rm; git commit -m "wip"' | |
alias gunwip='git log -n 1 | grep -q -c wip; and git reset HEAD~1' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment