Skip to content

Instantly share code, notes, and snippets.

@laander
Created December 22, 2010 13:49
Show Gist options
  • Save laander/751521 to your computer and use it in GitHub Desktop.
Save laander/751521 to your computer and use it in GitHub Desktop.
A quick reference for everyday github use with often used commands
// Full reference to be found at http://help.github.com/
// Or append a --help to the commands to get man page
// Different github rep urls for different uses
git@github.com:user/repo.git // Full access for reps youre a collaborator at
git://github.com/user/repo.git // Read-only using the git protocol
http://github.com/user/repo.git // Read-only over HTTP
// Working on an existing remote rep locally
git clone git@github.com:user/repo.git // Creates a new subfolder, fetches the content and checkout the default branch
git fetch REMOTENAME // Used for existing reps with remotes already setup
git pull REMOTENAME BRANCHNAME // Same as above put performs a merge also
git checkout -b branchname origin/branchname
// Set up a new local rep with existing files and push to a remote github rep
git init
git add -A
git commit -m 'message here'
git remote add konscript git@github.com:user/repo.git
git push konscript master
// Get a status of new changes to the local rep and commit + push these to the remote rep
git status
git add -u // Only updates tracked files
git add -A // Also removes deleted files and add new ones
git commit -m 'message here'
git push konscript master
// Branch out and develop on a parallel tree
git branch branchname // Create new branch
git checkout branchname // Switch to another branch
git merge branchname // Merges the specified branch into the one currently at
git branch -d branchname // Deletes the specific branch
git branch -v // Show all existing branches and which one youre currently at
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment