Skip to content

Instantly share code, notes, and snippets.

@souljorje
Last active May 30, 2022 10:16
Show Gist options
  • Save souljorje/f372a990b5efa7ec498375205d731953 to your computer and use it in GitHub Desktop.
Save souljorje/f372a990b5efa7ec498375205d731953 to your computer and use it in GitHub Desktop.
Aliases for git bash
# ----------------------
# Git Aliases
# ----------------------
alias g='git'
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
function_exists() {
declare -f -F $1 > /dev/null
return $?
}
for al in `git --list-cmds=alias`; do
alias g$al="git $al"
complete_func=_git_$(__git_aliased_command $al)
function_exists $complete_fnc && __git_complete g$al $complete_func
done
[alias] # here could be any your aliases
co = checkout
ci = commit
st = status
br = branch
hist = log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short
type = cat-file -t
dump = cat-file -p
all = add .
ac = !git add -A && git commit -m
m = merge
msq = merge --squash
subupd = submodule update --remote --recursive --merge
p = push

git add -A && git commit -m "my comment" 😐
git ac "my comment" 🙂
gac "my comment" 😄

Here we go:
  1. Go to root C:\Users\USERNAME\
  2. Copy .bash_profile there
  3. Copy .gitconfig or paste code to existing
  4. Open bash and run
    source ~/.bash_profile
  5. Run
    gst # === git status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment