Skip to content

Instantly share code, notes, and snippets.

@spaceplesiosaur
Last active May 14, 2019 22:21
Show Gist options
  • Save spaceplesiosaur/b7c261e1e7e1a0406b287049b41a1918 to your computer and use it in GitHub Desktop.
Save spaceplesiosaur/b7c261e1e7e1a0406b287049b41a1918 to your computer and use it in GitHub Desktop.
Practicing Markdown for Turing

Beginner's Guide to Git

Git is a Version Control System, or VCS, that allows your to work efficiently on your own projects and collaborate effectively with others.

With Git, you can

  • Make sure that only the work you want gets added to the final project
  • Check to make sure that you aren't missing any work during staging, before the work is committed
  • Catch bugs before the hit production

A quick guide to GitHub

GitHub allows you to use Git with a remote repository that many people can access, so that you can collaborate with a team.

Reasons GitHub is better than literally everything else:

  1. Most experienced programmers know it
  2. You don't have to be on the same server to collaborate

Example

Say Harry is working on modifying an array with some team members. This is the array in the master repo:

rainbow = ["red", "orange", "yellow", "green", "blue", "violet"]

Harry wants to add "pink" to the end, so he pulls the project into his local repo, and edits it using rainbow.push("pink") to make the rainbow array rainbow=["red", "orange", "yellow", "green", "blue", "violet", "pink"]

At the same time, Hermione wants to change "violet" to "purple". She runs

var rainbow = ["red", "orange", "yellow", "green", "blue", "violet", "pink"];

console.log(rainbow.slice(-1))

followed by rainbow.push("purple")

Hermione pushes her changes, and they are accepted by the master repo. Now Harry wants to push his changes - but he gets an error. Why? His changes conflict because he hasn't updated his local repo with Hermione's changes. TBH I'm not sure if these changes would conflict, but I don't know enough code yet to know

Ta da!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment