Skip to content

Instantly share code, notes, and snippets.

@dpetzel
Created September 8, 2012 01:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dpetzel/3671075 to your computer and use it in GitHub Desktop.
Save dpetzel/3671075 to your computer and use it in GitHub Desktop.
My personal cheat sheet of git commands

My Personal Git Cheat Sheet

Purpose

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

Definitions

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

Commands

  • 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