Skip to content

Instantly share code, notes, and snippets.

@pavbsu
Last active June 3, 2020 11:00
Show Gist options
  • Save pavbsu/29df053c47fb21cbb748520831df2756 to your computer and use it in GitHub Desktop.
Save pavbsu/29df053c47fb21cbb748520831df2756 to your computer and use it in GitHub Desktop.
Git Bash aliases for Windows
# create a file C:\Users\[user]\.bashrc
# add this content
# add your own aliases or changes these ones as you like
# to make a dot (.bashrs) file in windows, create a file ".bashrs." (without extention) and save. windows will save it as ".bashrc"
# run `source ~/.bashrc` in console
alias la='ls -A'
alias l='ls -CF'
alias gs='git status -bsu'
alias gss='git status'
alias gsss='git diff --stat'
alias gsscached='git diff --cached --stat'
alias gd='git difftool HEAD --dir-diff'
alias gc='git checkout'
alias gcm='git checkout master'
alias gb='git branch'
alias gp='git pull'
alias ga='git add'
alias gl='git log'
alias glcl="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
alias glc="glcl -20"
alias gr='git rebase'
alias grm='git rebase master'
alias gpo='git push origin'
alias gamend='git commit --amend --no-edit'
alias gm='git commit --amend --no-edit -m'
alias grc='git rebase --continue'
alias gf='git fetch'
alias rem='git branch | grep -v master | xargs git branch -D'
alias vs='/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/2017/Enterprise/Common7/IDE/devenv.exe'
alias vsm="vs -Edit $(git status --porcelain | awk {'printf $2 '\"' '\"'}')"
alias subl='/c/Program\ Files/Sublime\ Text\ 3/sublime_text.exe'
alias r='clear'
alias cl='clear'
alias n='start notepad++'
alias sb='notepad ~/.bashrc'
alias sob='source ~/.bashrc'
alias dev='cd c:/dev/'
alias gcom='git commit -m'
alias gpou='git push --set-upstream origin $(git symbolic-ref HEAD --short)'
alias cmd='cmd.exe /c'
alias c='cmd'
alias s='start'
alias ex='explorer .'
alias gbd='git branch --merged | grep -v "*" | grep -v "master" | grep -v "develop" | xargs -n 1 git branch -d'
@akolybelnikov
Copy link

akolybelnikov commented Aug 29, 2018

hi Pavel, great list of aliases, thanks for that. I have added an alias for a better log view. Would you like to check and update from my fork?

@akolybelnikov
Copy link

alias gbd='git branch --merged | grep -v "*" | grep -v "master" | grep -v "develop" | xargs -n 1 git branch -d'

in order to clean up only the merged stuff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment