Intro to Git and Github – What on earth is git? – Sharing Code



Intro to Git and Github – What on earth is git? – Sharing Code

1 5


intro-to-git

Talk on why you, as a developer, need to be using git.

On Github womenwhocodedc / intro-to-git

Intro to Git and Github

http://womenwhocode.github.io/intro-to-git

What on earth is git?

  • Version control
  • Backing up code
  • Code sharing

Git is a tool we use for version control, backing up code, and to share code with other developers. So, what on earth is version control?

So what is "version control"?

So, what on earth is version control? It's the eleventh hour. Shit's due. You save the wrong thing, and then close your program. Crap! It's not working any more! How do you go back and fix it?
Git is a tool we use for version control, backing up code, and to share code with other developers.

"Version Control"

  • History of your changes
  • Give a little message about changes on save
  • Go back in history
  • Multiple versions of code with branches
Main reason git is popular is because of version control. Version control means you can have a history of the changes you've made to a file and it allows you to go back in time to previous versions of your file.

Backing up code

  • 'Remote repositories'
  • push-ing, pull-ing
  • Dropbox for code
Git allows you to back up your code really easily - it's something we're going to do later tonight using Github, which all of you have signed up for. It's like Dropbox (all of your files are backed-up on a remote server) except that with git, you're backing up the history of your files too. We call each project a repository or a repo, and then the files that we're backing up the remote repository. To get code from it and to put new code on it, we use the verbs push and pull.

Sharing Code

  • Code is better with friends!
  • Work remotely with a team

Recap on why you should use git

  • Save yourself from losing code
  • Back up your code because it's smart
  • Work with other devs because code is more fun with friends

So what is Github, then?

  • Website where you can backup your code (like Dropbox)
  • See other people's code (open-source)
  • Work with other devs to make stuff (pull requests)

So, let's try it.

Open your terminal:
mkdir code cd code mkdir sample-project cd sample-project
touch README.md git init git add README.md git commit -m "Our first file"

github.com

And when you refresh github...

Let's make some changes.

vim README.md

hit the letter "s"

Now we can type in the document.

how do i get out of vim?

When you're done typing, hit Control + c and then type :wq.

let's make another file and then push everything to github.

touch index.html git add --all Shorthand for 'add everything' git commit -m "Commit message" git push
git log

Resources

Try Git in your Browser Create a Repo Github Bootcamp Github Help Intro to the Command Line

@helenvholmes

@kapoornupur

@kgibilterra

@womenwhocodedc

http://womenwhocodedc.github.io/intro-to-git/