intro to git, github, and devpost

88
Code Collaboration and Submission Git, GitHub, and Devpost 1

Upload: andrew-kerr

Post on 09-Jan-2017

444 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Intro to Git, GitHub, and Devpost

Code Collaboration and Submission

Git, GitHub, and Devpost 1

Page 2: Intro to Git, GitHub, and Devpost

Git, GitHub, and Devpost

Git, GitHub, and Devpost 2

Page 3: Intro to Git, GitHub, and Devpost

whoami

Git, GitHub, and Devpost 3

Page 4: Intro to Git, GitHub, and Devpost

whoami

• Fifth year Software Engineering @ UF

Git, GitHub, and Devpost 4

Page 5: Intro to Git, GitHub, and Devpost

whoami

• Fifth year Software Engineering @ UF

• Officer of the UF Student InfoSec Team

Git, GitHub, and Devpost 5

Page 6: Intro to Git, GitHub, and Devpost

whoami

• Fifth year Software Engineering @ UF

• Officer of the UF Student InfoSec Team

• Full stack web developer

Git, GitHub, and Devpost 6

Page 7: Intro to Git, GitHub, and Devpost

whoami

• Fifth year Software Engineering @ UF

• Officer of the UF Student InfoSec Team

• Full stack web developer

• Currently web eng lead at Quottly

Git, GitHub, and Devpost 7

Page 8: Intro to Git, GitHub, and Devpost

whoami

• Fifth year Software Engineering @ UF

• Officer of the UF Student InfoSec Team

• Full stack web developer

• Currently web eng lead at Quottly

• Former security intern at Tumblr

Git, GitHub, and Devpost 8

Page 9: Intro to Git, GitHub, and Devpost

whoami

• Fifth year Software Engineering @ UF

• Officer of the UF Student InfoSec Team

• Full stack web developer

• Currently web eng lead at Quottly

• Former security intern at Tumblr

• Former intern at BlockScore

Git, GitHub, and Devpost 9

Page 10: Intro to Git, GitHub, and Devpost

whoami

• Fifth year Software Engineering @ UF

• Officer of the UF Student InfoSec Team

• Full stack web developer

• Currently web eng lead at Quottly

• Former security intern at Tumblr

• Former intern at BlockScore

• Reach me @andrew on Slack

Git, GitHub, and Devpost 10

Page 11: Intro to Git, GitHub, and Devpost

Git

Git, GitHub, and Devpost 11

Page 12: Intro to Git, GitHub, and Devpost

At it's core, git is version control

Git, GitHub, and Devpost 12

Page 13: Intro to Git, GitHub, and Devpost

What is version control?

Git, GitHub, and Devpost 13

Page 14: Intro to Git, GitHub, and Devpost

Version control tracks changes in your code

Git, GitHub, and Devpost 14

Page 15: Intro to Git, GitHub, and Devpost

Git, GitHub, and Devpost 15

Page 16: Intro to Git, GitHub, and Devpost

Why is this useful?

Git, GitHub, and Devpost 16

Page 17: Intro to Git, GitHub, and Devpost

Collaboration

Git, GitHub, and Devpost 17

Page 18: Intro to Git, GitHub, and Devpost

How does this work?

Git, GitHub, and Devpost 18

Page 19: Intro to Git, GitHub, and Devpost

How does this work?

1. Download code from remote server

Git, GitHub, and Devpost 19

Page 20: Intro to Git, GitHub, and Devpost

How does this work?

1. Download code from remote server

2. Make your changes

Git, GitHub, and Devpost 20

Page 21: Intro to Git, GitHub, and Devpost

How does this work?

1. Download code from remote server

2. Make your changes

3. Upload code to remote server

Git, GitHub, and Devpost 21

Page 22: Intro to Git, GitHub, and Devpost

How does this work?

1. Download code from remote server

2. Make your changes

3. Upload code to remote server

4. Version control figures out what has changed and applies those changes to the codebase

Git, GitHub, and Devpost 22

Page 23: Intro to Git, GitHub, and Devpost

Cool, so let's talk about git

Git, GitHub, and Devpost 23

Page 24: Intro to Git, GitHub, and Devpost

Git Basics

Git, GitHub, and Devpost 24

Page 25: Intro to Git, GitHub, and Devpost

Open up a terminal!

Git, GitHub, and Devpost 25

Page 26: Intro to Git, GitHub, and Devpost

1. Make a new directory

Git, GitHub, and Devpost 26

Page 27: Intro to Git, GitHub, and Devpost

2. git init

Git, GitHub, and Devpost 27

Page 28: Intro to Git, GitHub, and Devpost

3. git status

Git, GitHub, and Devpost 28

Page 29: Intro to Git, GitHub, and Devpost

4. Make a file

Git, GitHub, and Devpost 29

Page 30: Intro to Git, GitHub, and Devpost

5. git status

Git, GitHub, and Devpost 30

Page 31: Intro to Git, GitHub, and Devpost

6. git add .

Git, GitHub, and Devpost 31

Page 32: Intro to Git, GitHub, and Devpost

6. git add .

• "staged files" are files that are ready to be committed to git

• "unstaged files" are files that have changes that have not been prepared to be committed

Git, GitHub, and Devpost 32

Page 33: Intro to Git, GitHub, and Devpost

can also use git add [filename] for individual files

Git, GitHub, and Devpost 33

Page 34: Intro to Git, GitHub, and Devpost

7. git status

Git, GitHub, and Devpost 34

Page 35: Intro to Git, GitHub, and Devpost

8. git commit -m 'Summary of changes'

Git, GitHub, and Devpost 35

Page 36: Intro to Git, GitHub, and Devpost

9. git log

Git, GitHub, and Devpost 36

Page 37: Intro to Git, GitHub, and Devpost

Any questions?

Git, GitHub, and Devpost 37

Page 38: Intro to Git, GitHub, and Devpost

Git Branches

Git, GitHub, and Devpost 38

Page 39: Intro to Git, GitHub, and Devpost

Git Branches

• A "copy" of code that developers can work on independently of the main code base

Git, GitHub, and Devpost 39

Page 40: Intro to Git, GitHub, and Devpost

Git Branches

• A "copy" of code that developers can work on independently of the main code base

• The main code base is normally "master"

• Once the developer is done, can "merge" it back into master

Git, GitHub, and Devpost 40

Page 41: Intro to Git, GitHub, and Devpost

git branch [branchname]

Git, GitHub, and Devpost 41

Page 42: Intro to Git, GitHub, and Devpost

Once we have a new branch, we follow the git flow

Git, GitHub, and Devpost 42

Page 43: Intro to Git, GitHub, and Devpost

We have new code on a branch, how do we merge back?

Git, GitHub, and Devpost 43

Page 44: Intro to Git, GitHub, and Devpost

git checkout master

Git, GitHub, and Devpost 44

Page 45: Intro to Git, GitHub, and Devpost

git merge [branchname]

Git, GitHub, and Devpost 45

Page 46: Intro to Git, GitHub, and Devpost

Using branches allows for multiple developers to work on

the same code base

Git, GitHub, and Devpost 46

Page 47: Intro to Git, GitHub, and Devpost

Any questions?

Git, GitHub, and Devpost 47

Page 48: Intro to Git, GitHub, and Devpost

Git Remotes

Git, GitHub, and Devpost 48

Page 49: Intro to Git, GitHub, and Devpost

Git Remotes

• A remote server for your git repository!

Git, GitHub, and Devpost 49

Page 50: Intro to Git, GitHub, and Devpost

Git Remotes

• A remote server for your git repository!

• This is where GitHub comes in...

Git, GitHub, and Devpost 50

Page 51: Intro to Git, GitHub, and Devpost

GitHub

Git, GitHub, and Devpost 51

Page 52: Intro to Git, GitHub, and Devpost

Powerful collaboration, code review, and code

management foropen source and private

projects.Git, GitHub, and Devpost 52

Page 53: Intro to Git, GitHub, and Devpost

Helps put a GUI on top of git!

Git, GitHub, and Devpost 53

Page 54: Intro to Git, GitHub, and Devpost

Sign up for GitHub at github.com

Git, GitHub, and Devpost 54

Page 55: Intro to Git, GitHub, and Devpost

Once signed up, create a repository

Git, GitHub, and Devpost 55

Page 56: Intro to Git, GitHub, and Devpost

Get the remote ssh url

Git, GitHub, and Devpost 56

Page 57: Intro to Git, GitHub, and Devpost

Back to the command line...

Git, GitHub, and Devpost 57

Page 58: Intro to Git, GitHub, and Devpost

git remote add origin [url]

Git, GitHub, and Devpost 58

Page 59: Intro to Git, GitHub, and Devpost

git remote -v

Git, GitHub, and Devpost 59

Page 60: Intro to Git, GitHub, and Devpost

So, how do we get code on our remote?

Git, GitHub, and Devpost 60

Page 61: Intro to Git, GitHub, and Devpost

git push

Git, GitHub, and Devpost 61

Page 62: Intro to Git, GitHub, and Devpost

Awesome! Now we've got code on GitHub

Git, GitHub, and Devpost 62

Page 63: Intro to Git, GitHub, and Devpost

Once a teammate pushes changes, make sure to use git pull to download the new

changes

Git, GitHub, and Devpost 63

Page 64: Intro to Git, GitHub, and Devpost

Any questions?

Git, GitHub, and Devpost 64

Page 65: Intro to Git, GitHub, and Devpost

GitHub + Devpost

Git, GitHub, and Devpost 65

Page 66: Intro to Git, GitHub, and Devpost

Git, GitHub, and Devpost 66

Page 67: Intro to Git, GitHub, and Devpost

Preparing your GitHub repo for submission

Git, GitHub, and Devpost 67

Page 68: Intro to Git, GitHub, and Devpost

1. Create a README.md file

Git, GitHub, and Devpost 68

Page 69: Intro to Git, GitHub, and Devpost

Example: https://github.com/andrewjkerr/hackathon-mentor-

request-slackbot

Git, GitHub, and Devpost 69

Page 70: Intro to Git, GitHub, and Devpost

Git, GitHub, and Devpost 70

Page 71: Intro to Git, GitHub, and Devpost

2. Set the description

Git, GitHub, and Devpost 71

Page 72: Intro to Git, GitHub, and Devpost

"A slackbot to help manage mentorship

requests for hackathons (aka SwampHacks)."

Git, GitHub, and Devpost 72

Page 73: Intro to Git, GitHub, and Devpost

Anddd that's it! Pretty easy, eh?

Git, GitHub, and Devpost 73

Page 74: Intro to Git, GitHub, and Devpost

To review

Git, GitHub, and Devpost 74

Page 75: Intro to Git, GitHub, and Devpost

To review

1. git pull

Git, GitHub, and Devpost 75

Page 76: Intro to Git, GitHub, and Devpost

To review

1. git pull2. git checkout -b branch

Git, GitHub, and Devpost 76

Page 77: Intro to Git, GitHub, and Devpost

To review

1. git pull2. git checkout -b branch3. Make changes

Git, GitHub, and Devpost 77

Page 78: Intro to Git, GitHub, and Devpost

To review

1. git pull2. git checkout -b branch3. Make changes4. git add .

Git, GitHub, and Devpost 78

Page 79: Intro to Git, GitHub, and Devpost

To review

1. git pull2. git checkout -b branch3. Make changes4. git add .5. git commit -m 'commit summary'

Git, GitHub, and Devpost 79

Page 80: Intro to Git, GitHub, and Devpost

To review

1. git pull2. git checkout -b branch3. Make changes4. git add .5. git commit -m 'commit summary'6. git checkout master

Git, GitHub, and Devpost 80

Page 81: Intro to Git, GitHub, and Devpost

To review (continued...)

1. git pull

Git, GitHub, and Devpost 81

Page 82: Intro to Git, GitHub, and Devpost

To review (continued...)

1. git pull2. git merge branch

Git, GitHub, and Devpost 82

Page 83: Intro to Git, GitHub, and Devpost

To review (continued...)

1. git pull2. git merge branch3. git push

Git, GitHub, and Devpost 83

Page 84: Intro to Git, GitHub, and Devpost

To review (continued...)

1. git pull

2. git merge branch

3. git push

4. Do it all again!

Git, GitHub, and Devpost 84

Page 85: Intro to Git, GitHub, and Devpost

Git and GitHub can help teams work more efficiently on code

Git, GitHub, and Devpost 85

Page 86: Intro to Git, GitHub, and Devpost

(And it doesn't hurt that GitHub works well with Devpost)

Git, GitHub, and Devpost 86

Page 87: Intro to Git, GitHub, and Devpost

Any questions?

Git, GitHub, and Devpost 87

Page 88: Intro to Git, GitHub, and Devpost

Slides available at talk.andrewjkerr.com

Git, GitHub, and Devpost 88