1 of 13

Intro to Git & GitHub

By Sean O’Mahoney

2 of 13

Git vs GitHub

  • Git is just version control
  • But is a distributed version control system
  • Meaning you can push/pull from other peoples machines

  • GitHub is a host for repo’s
  • But has many more features
  • It allows vast collaboration
  • Also provides a visual interface

3 of 13

What? (GitHub)

“Founded in 2007, GitHub has brought millions of developers together to discover, share, and build better software.” – GitHub

  • Collaboration
  • Version Control
  • Submit issues & comment
  • Web & Visual Desktop interface
  • GitHub Pages (Free Website Hosting)

4 of 13

Setting up Git

  • From your Start Menu locate Git and open Git CMD (Bash should be fine as well)
  • This will open up a new terminal window in your “H:” Drive
  • Create a new file by running “mkdir [file_name]”
  • To navigate to this new folder, run “cd [file_name]”
  • Now we’re in the new folder we can start using Git

5 of 13

Using Git

1

To create a new repository where we are, we’ll run “git init

2

Now we can create files and modify them, but to add them to git, we run “git add *

3

To stage a change, to add a point in time, we run: git commit -m "Commit message“

4

If we’ve made any mistakes and wish to go back a commit, we can run “git revert

6 of 13

Sign-up to GitHub

Now we’ll push our repo’ to a remote server, GitHub, meaning we’ll need an account

7 of 13

8 of 13

Git -> GitHub

  • Now we have created a new repo’ on GitHub to use, but we have our own so we’ll use it
  • By running “git remote add origin git@github.com:[user]/[repo].git” we’ll connect it
  • It might ask you to sign in, especially if you had the HTTPS option selected (and not SSH)
  • Then to push our local files from Git, we’ll run “git push -u origin master

9 of 13

Rinse & Repeat (for Simple Projects)

  • If you add any new files to the project, run “git add [filename]” or “git add *
  • To commit any changes, run: git commit -m "Commit message“
  • Then to push back up to GitHub, run: “git push” or “git push origin master

  • If we make changes on another machine, the GitHub Website or are unsure anyone has made any changes to the master branch, we can run “git pull” to pull any changed/added files to the repo’

10 of 13

Branching

Branches are essentially a copy of a point in time of your repo, then worked on separately, we have referred to “master” before, and this is the main branch you create and work on.

But lets say you want to test code out before making it live on the master branch, or someone else wants to use your project, either modifying it for their needs or adding more, then we’d have a branch of the repo’

  • To create a new branch of our own repo’, we can run: “git branch [branch-name]”
  • From there we can work on it like we have been doing prior
  • To switch back to our master branch or another, we can run: “git checkout [branch-name]”
  • Then finally to merge the changes, we run: “git merge [branch]”

11 of 13

Forking (Cloning in Git)

This is the action made creating a new branch, but is used to refer to when you “fork”/clone someone else's repo’ (which you will likely not have permission to commit changes to)

  • To clone someone's public repo’ on Git, it’s as simple as running: “git clone [url]
  • Cloning on Git is different then Forking on GitHub, so it’s easy to use the web interface
  • ?????

12 of 13

Student Developer Pack - GitHub Education

  • Atomatom.io A hackable text editor for the 21st Century Open Source by GitHub, free for everyone
  • Bitnamibitnami.com Install cloud applications in a single click Business 3 plan (normally $49/month) for one year
  • DigitalOceandigitalocean.com Simple cloud hosting, built for developers $100 in platform credit for new users
  • DNSimplednsimple.com Simple DNS management with one-click services and a robust API Bronze hosted DNS plan (normally $3/month) for two years
  • Figure Eightfigure-eight.com Data enrichment platform Access to the Figure Eight platform (normally $2,500/month) and $50 in worker credit
  • GitHubgithub.com Powerful collaboration, code review, and code management Micro account (normally $7/month) with five private repositories while you’re a student
  • HackHandshackhands.com Live programming help available 24/7 $25 in platform credit
  • Namecheapnamecheap.com Domain name registration and SSL certificates One year free domain name registration on the .me TLD (normally 8.99/year) and one year free SSL certificate (normally $9/year)
  • Orchestrateorchestrate.io Database API that includes search, time-series events, geolocation and graph queries Developer account (normally $49/month) while you’re a student
  • Screenheroscreenhero.com Screen sharing for collaboration in teams Individual account (normally $9.99/month) while you’re a student
  • SendGridsendgrid.com Email infrastructure as a service Student plan (normally $4.95/month) for one year
  • Stripestripe.com Web and mobile payments, built for developers Waived transaction fees on first $1,000 in revenue processed
  • Travis CItravis-ci.com Continuous integration platform for open source and private projects Private builds (normally $69/month) while you’re a student
  • Unreal Engineunrealengine.com A complete suite of game development tools made by game developers, for game developers Unreal Engine (normally $19/month) while you’re a student

2014 @ https://blog.github.com/2014-10-07-the-best-developer-tools-now-free-for-students/

13 of 13

Resources & Useful Links