Skip to content

Instantly share code, notes, and snippets.

@WebDevLuke
Created May 28, 2019 17:06
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 WebDevLuke/92f306a0bded42a0fa2d8fcc25a12959 to your computer and use it in GitHub Desktop.
Save WebDevLuke/92f306a0bded42a0fa2d8fcc25a12959 to your computer and use it in GitHub Desktop.
A few shortcuts for git in bash. Add to ~/.bash_profile
# Go to git directory
alias g='cd ~/git';
# What's happening?
alias gs='git status';
# Add all files to staging area
alias ga='git add -A';
# Add only tracked files to staging area
alias gau='git add -u';
# Push current branch
alias gp='git push origin HEAD';
# Pull current branch
alias gpl='git pull origin HEAD';
# Pass optional message to commit, like:- gc "my commit"
function gc() {
[ "$1" ] && local msg="$1" || local msg="My automated commit"
git add -A && git commit -m "$msg" && git push origin HEAD
}
export -f gc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment