Skip to content

Instantly share code, notes, and snippets.

@itsmunim
Created April 3, 2020 07:06
Show Gist options
  • Save itsmunim/b41e8f0f5d7f6f42f370bf511c2cd4ed to your computer and use it in GitHub Desktop.
Save itsmunim/b41e8f0f5d7f6f42f370bf511c2cd4ed to your computer and use it in GitHub Desktop.
Necessary bash profile aliases
# git shortcuts
alias fetch="git fetch origin"
alias push="git push origin" # push to branch
alias fpush="git push -f origin" # force-push to branch
alias pull="git pull --rebase origin" # always do safe pull from a remote branch to avoid any merge commits getting created
alias clr="git cleanup" # deletes the branches which are already merged
alias rrw="git pull --rebase origin" # remote rebase with
alias delbr="git br -D"
alias delall="git branch | grep -v 'master' | xargs git branch -D" # del all local branches except master
alias rename="git co master && git br -m ${1} ${2}" # rename branch 1 to 2
alias irfromstart="git rebase -i --root $tip" # iterative rebase from first commit
# lets you set email and author on repo basis
# useful when you dont want to use your official name and email
# in your personal project repos
alias setauthor_email="git config user.email"
alias setauthor_name="git config user.name"
@itsmunim
Copy link
Author

itsmunim commented Apr 3, 2020

Usage samples-

fetch feat/format-123

push feat/format-124-expose-cache-api

clr

rrw master # same as pull

delall

delbr infra/format-990-setup-terraform

rename chore/format-221-add-spec task/format-221-add-spec

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