Skip to content

Instantly share code, notes, and snippets.

@joelgriffith
Last active December 25, 2015 15:48
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 joelgriffith/7000453 to your computer and use it in GitHub Desktop.
Save joelgriffith/7000453 to your computer and use it in GitHub Desktop.
Helpful git commands
# Add a remote repository at URL named NAME
git remote add NAME URL
# Show me my local branches
git branch -a
# Show me my remote repositories
git remote -v
# Create a new local branch with NAME and switch to it
git checkout -b NAME
# Fetch all the data associated with this REMOTE repository
git fetch REMOTE
# Rebase the branch that I'm currently in (should be master!) with the data from REMOTE/master
# Note that it's important to fetch the data prior
git rebase REMOTE/master
# I'm done trying to rebase
git rebase --abort
# Merge the changes from BRANCH into the branch I'm currently in (usually for merging rebased changes in master to your feature branch)
git merge BRANCH
# WTF is git doing right meow
git status
# Fetch the updates from the upstream remote and rebase the branch I'm in with the changes from upstream/master
git fetch upstream && git rebase upstream/master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment