Skip to content

Instantly share code, notes, and snippets.

@Mandalorian007
Last active June 9, 2018 11:51
Show Gist options
  • Save Mandalorian007/df36c0c265482e67b37ee855dd05a7c9 to your computer and use it in GitHub Desktop.
Save Mandalorian007/df36c0c265482e67b37ee855dd05a7c9 to your computer and use it in GitHub Desktop.
Basic instructions for using git and github
Concept Summaries
Verson Control - Is a change tracking system that let's us roll our code backwards in time to revert any change.
Centralized - A single master copy of the files and individuals will "lock" certain files while they are working on them
Distributed - Every computer gets a copy and when they come back to the main repository they need to sync up
Git - Is a distributed version control system. That focuses around the changes in code
GitHub - A massive website that holds a bunch of server side git repositories. Github makes it easy to share and colaborate on code
#In your workspace you can start a new git repository
git init
#Add your current project files to git's change tracking
git add .
#Have git save your current changes
git commit -m "Initial commit"
#Link your local git to your github repository (use ssh)
git remote add origin https://github.com/<USERNAME>/<PROJECT_NAME>.git
#Check your remote url is correct
git remote -v
#Push your changes to Github
git push -u origin master
#Change any files you want! Then check changes with
git diff
#If you added a new file
git add .
#Save your changes
git commit -m "My changes"
#Publish your changes to the server
git push
-- More Advanced
#Create a new branch
git branch <NEW_BRANCH_NAME>
#View all your branches
git branch
#Checkout a branch
git checkout <BRANCH_NAME>
#Push your branch up to the server
git push -u origin <BRANCH_NAME>
#Demo a server side pull request
#Readme format: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment