Skip to content

Instantly share code, notes, and snippets.

@ralexandr
Created October 27, 2020 03:13
Show Gist options
  • Save ralexandr/b8d48892065e9581866bd9c494bdaac8 to your computer and use it in GitHub Desktop.
Save ralexandr/b8d48892065e9581866bd9c494bdaac8 to your computer and use it in GitHub Desktop.
Git shell aliases
# Copy-paste following code to your .bashrc/.zshrc file and restart your terminal session (or run 'source ~/.bashrc' command)
# git
alias gs="git status"
alias gp="git pull"
alias gpo="git push origin $1"
alias gb="git branch"
alias ga="git add ."
alias gc="git pull && git commit -m $1"
function git_checkout_branch() {
git checkout -b "$@";
git push --set-upstream origin "$@";
}
alias gcb="git_checkout_branch $1"
@ralexandr
Copy link
Author

Then you will be able to check if there is some remote updates and create new commit by typing smth like:

gc "Some awesome commit message"

Or create new branch, switch to it and push it to remote repo

gcb feature/new-awesome-feature

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