Back to all snippets

Quick Git

Published 📅: ....
Last modified 📝: ....
Location 📍: Boston, MA

Share this snippet on BlueskySee discussion on Bluesky


This is a really simple git alias that I think I found originally on Twitter a while back - and since then it's been my go-to way to work on repos that I'm effectively the only contributor:

# the git zsh plugin aliases gp as git push
# but we want to override it
unalias gp
gp() {
  git add .
  git commit -m "$1"
  git push
}

Usage:

gp "commit message here"

Explanation:

This little alias/function:

  • Adds all changes to be staged
  • Commits with the provided message
  • Pushes it to the remote tracking branch

This little pattern has been so useful that it's prevented me from experimenting with jj because this is just too easy. I rarely need to use git branches for most of the things I do as side projects so this has been my go to!


Tags:

Loading...