Skip to content

Instantly share code, notes, and snippets.

@kitzberger
Last active March 2, 2019 09:46
Show Gist options
  • Save kitzberger/dfe059a28235468826f59e2c10c3cfbd to your computer and use it in GitHub Desktop.
Save kitzberger/dfe059a28235468826f59e2c10c3cfbd to your computer and use it in GitHub Desktop.
Git stuff for .bashrc
# Pull the remote branch of the same name by default
git config --global pull.branch current
# Push the local branch to remote with the same name by default
git config --global push.branch current
# Use vim as default editor
git config --global core.editor "vim"
# Show indicator in git prompt whenever the status isn't clean
GIT_PS1_SHOWDIRTYSTATE=true
# Helpful aliases
alias gitlog='git log --graph --all --decorate --oneline'
alias gitlog2='git log --graph --decorate --oneline'
alias gitlog3='git log --pretty=format:"%C(yellow)%h%Creset %C(cyan)%ae%Creset %Cred%ar%Creset: %s%Cgreen%d" --all --graph'
alias gitlog4='git log --oneline --graph --decorate master^2..origin/develop'
alias gitlog5='git log origin/master.. --first-parent --oneline'
alias gitdiff='git diff --submodule'
alias gitdiffword="git diff --word-diff-regex=[^[:space:],\\;\\']+"
alias gitb='git branch -vv'
alias gitb2='echo "Branches not merged into this branch:"; git branch -vv -r --no-merged'
alias gits='git status --short --branch'
# Remove already merged branches
alias gitprune='git remote prune origin && git branch --merged | egrep -v "(^\*|master|dev)" | ifne xargs git branch -d'
# Set upstream to remote branch of the same name as local branch
alias gitbu='BRANCH=$(git symbolic-ref --short HEAD) && git branch --set-upstream-to=origin/$BRANCH $BRANCH'
function gitpush() {
git push --all "$@"
git push --tags "$@"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment