Skip to content

Instantly share code, notes, and snippets.

@smerrill
Created March 23, 2013 16:33
Show Gist options
  • Save smerrill/5228331 to your computer and use it in GitHub Desktop.
Save smerrill/5228331 to your computer and use it in GitHub Desktop.
# Remote management
git remote -v
git remote add <remote-name> <url>
git remote set-url <remote-name> <url>
# Working with branches
git branch : Show all local branches git knows about
git branch -a : Show all branches on all remotes that git knows about
git log : Show the commits on the current local branch
git reset --hard <ref-name> : Reset the current branch to the given ref (a ref could be a commit hash or a branch name)
# Pushing and pulling
git fetch <remote-name> : Get all information about commits and branches from a remote repo with merging them into the local branch
git push <remote-name> <branch> : Push commits on a branch to a remote repository
git pull <remote-name> <branch> : Pull commits from a remote repository and merge them into your local branch
git push <remote-name> --all : Push all the commits to the repository
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment