Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
My personal cheat sheet of git commands

My Personal Git Cheat Sheet


Since I keep googling these over and over.....


upstream = The original repo, from which I forked origin = My forked copy, or the repo I am pushing directly to


  • Sync master back with Origin (after having got ahead of Origin):

    git remote update
    git reset --hard upstream/master
    git push origin +master
  • Create a feature branch:

    git checkout -b <branch_name>
  • Push that new feature branch to origin:

    git push origin <branch_name>
  • Cleanup a feature branch (local and origin):

    git branch -D <branch_name>
    git push origin --delete <branch_name>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.