Skip to content

Instantly share code, notes, and snippets.

@dalenguyen
Last active June 19, 2019 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dalenguyen/eab7d316cd8223096db41a4218ee24c1 to your computer and use it in GitHub Desktop.
Save dalenguyen/eab7d316cd8223096db41a4218ee24c1 to your computer and use it in GitHub Desktop.
Git shortcuts in Bash
# Github
alias gs="git status"
alias gd="git diff"
alias gp="git pull"
# Git finish will push to current branch
# Eg. gf "commit message"
gf() {
CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
git add . && git commit -m "$1" && git push origin "$CURRENT_BRANCH"
}
# Git merge
# Eg. gm branch-name
gm() {
git merge "$1"
}
# Git checkout
# Eg. gc branch-name
gc(){
git checkout "$1" && gp
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment