Skip to content

Instantly share code, notes, and snippets.

@mtlynch
Last active April 23, 2021 18:30
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 mtlynch/80b3e46e239b8cd1355da0c1a7548329 to your computer and use it in GitHub Desktop.
Save mtlynch/80b3e46e239b8cd1355da0c1a7548329 to your computer and use it in GitHub Desktop.
function git_sync_and_branch {
local readonly TARGET_BRANCH="$1"
git checkout master && \
git pull origin master
if [[ ! -z "$TARGET_BRANCH" ]]; then
git checkout -b "${TARGET_BRANCH}"
fi
}
alias gcbm='git_sync_and_branch' # Sync master and check out new branch
alias gau='git add --update'
alias ga='git add -A'
alias gb='git branch -v --sort=committerdate'
alias gc='git commit -m'
alias gs='git status'
alias gu='git reset --soft HEAD~1' # Git undo
alias gd='git diff --cached'
alias gss='git stash save'
alias gsp='git stash pop'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment