Pro Yearly is on sale from $80 to $50! »

Mastering Github

346a18ecad3be442898fc28c02230c93?s=47 Ian Clarke
February 26, 2015

Mastering Github

Since most students don't have proper knowledge of version control, like git, this was another workshop I organized and spoke at Carleton.

346a18ecad3be442898fc28c02230c93?s=128

Ian Clarke

February 26, 2015
Tweet

Transcript

  1. Welcome to: MASTERING GITHUB

  2. SO, What is the point of source control/git?

  3. It ORGANIZES • Keeping history/versions manually is inefficient • Git/Source

    control keeps things tidy • Make deployments super easy • Git bash makes sure you know what files are added
  4. It SAVES YOUR BUTT • Ensures you always have access

    to you code (GitHub) • Made an error? No problem • Makes deployments super easy • Go back to any point in time
  5. Its EASY • Not much knowledge is needed to use

    • Tons of tutorials online • Makes contributing to open source stuff really easy • Lots of Git GUI's!
  6. Wait, What's the diff!!!?? GIT/GITHUB • Online social repo tool

    • Receives data from your git clients • Functions as a cloud storage (known as 'repos') • The actual source control • Handles branching/commits • What you use on your computer
  7. Allright, LETS GET STARTED Using git

  8. Now FIRST, 1. Go to git-scm.com 2. Download the client

    for windows 3. Open up the exe once it's done
  9. Click through the setup until you come to these screens

    and follow them NEXT,
  10. Click through the setup until you come to these screens

    and follow them NEXT, Then, open up 'Git Bash' from the start menu
  11. NOW, 1. Go to github.com 2. Make an account 3.

    Make an empty repository!
  12. CONT' Name it 'GitWorkshop', and give it a description if

    you want 12
  13. CONT' Now we must add some code to it! 13

  14. Finally! LETS PUSH SOME CODE! Quick clarification: • 'Pushing' in

    git means to send some code to a remote server • 'git init' initializes a new repository • Navigating in windows: • 'cd' = navigate into • 'ls' = list items within this directory
  15. FIRST, We need to make sure git knows who we

    are, so let's set up our username on github and email! 15
  16. ADDING CODE Let's just make a new file in notepad

    called 'bleh.txt' Save this in a folder called 'GitWorkshop' on your desktop 16
  17. ADDING CODE Now, we need to go into this folder!

    Open up git bash and navigate to your folder where you put the .txt file 17
  18. ADDING CODE Now we need to tell git that this

    is a repository! To do this, write in 'git init' 18
  19. ADDING CODE Now we need to add our 'bleh.txt' To

    do this, write in 'git add bleh.txt' 19
  20. ADDING CODE Now we need to tell git to remember

    what is in 'bleh' at THIS point in time To do this, merely say 'git commit -m 'This is my first commit'' 20
  21. ADDING CODE Now we need to send our code somewhere,

    so lets send it to the empty repository we made on github. To do this, we need to add a destination, then 'push' it 21
  22. ADDING CODE We should now see our awesome file on

    github now! 22
  23. CHECKING CODE If you ever want to see what code

    you have ready for committing or if you are missing something, use 'git status' We can also look at the commit history by saying 'git log' 23
  24. PULLING CODE Oops, we forgot to add a readme! Let's

    do that in GitHub now! 24
  25. PULLING CODE Ok.... now we need to get that README

    into our computer so we can edit it better. To do this, simply say 'git pull' 25
  26. BRANCHING 101 What if I have a new bit of

    code that I want to work on that might be a new feature? Something that might involve a new set of files other than the ones we just created To do this in git and allow us to work with multiple people, we use what is called 'branching' 26
  27. BRANCHING 101 To create a branch, write 'git branch branch-name-here'

    And to actually edit that branch, 'git checkout branch-name- here' 27
  28. BRANCHING 101 Now lets add our new feature! 28

  29. BRANCHING 101 Now let's push that branch to github so

    people can see we're working on it 29
  30. BRANCHING 101 Now say we're done with that branch! So

    lets merge it into the master branch as it is completed! 30
  31. Well,what if I made a MISTAKE? • If you have

    made a mistake and want to redo it, simply follow these steps