Saturday, July 21, 2012

Git / GitHub Cheat Sheet

This mainly for my reference!

Checkout a repo from GitHub
git clone git@github.com:[username]/[project name].git
 
Add single file 
git add [FILENAME] 
Add everything and all sub dirs  
git add .
Also wild characters
git add *.c

Locally commit the files / staging 
git commit -m "commit message goes here" 
 
Commit back to github
git push origin master 

Get the latest changes from github
git pull
 
Forking your own git project
- Make a new project (don't auto generate a readme)
- Clone it locally
- Navigate to the dir and 
git remote add upstream https://github.com/[repo name]/[Project want to clone] 
git fetch upstream




No comments: