yes, you can git!

37
YES, YOU CAN GIT! INTRODUCTION TO GIT AND GITHUB Carol Willing @willingcarol GitHub: willingc WRITE SPEAK CODE JUNE 17, 2016

Upload: carol-willing

Post on 19-Jan-2017

142 views

Category:

Software


1 download

TRANSCRIPT

Page 1: Yes, you can git!

Y E S , Y O U C A N G I T !I N T R O D U C T I O N T O G I T A N D G I T H U B

Carol Willing@willingcarol GitHub: willingc

W R I T E S P E A K C O D E J U N E 1 7 , 2 0 1 6

Page 2: Yes, you can git!

– M A R Y O L I V E R

“It’s not a competition, it’s a doorway.”

Page 3: Yes, you can git!

C H AT T I N G W I T H F R I E N D S

• git

• a tool

• puts you in charge of source files

• GitHub

• a service

• sharing and collaboration

Page 4: Yes, you can git!

C A L M

Page 5: Yes, you can git!

N A M I N G P L A C E SL O C A L ( Y O U A R E H E R E ) , O R I G I N , U P S T R E A M

Page 6: Yes, you can git!

L O C A L ( Y O U A R E H E R E )

O R I G I N ( Y O U I N T H E C L O U D )

U P S T R E A M ( S O M E W H E R E E L S E I N T H E C L O U D )

Page 7: Yes, you can git!

L O C A L ( g i t )

O R I G I N ( y o u o n G i t H u b )

U P S T R E A M ( o p e n s o u r c e p r o j e c t o n G i t H u b )

Page 8: Yes, you can git!

L O C A L ( g i t )

O R I G I N ( y o u o n G i t H u b )

U P S T R E A M ( o p e n s o u r c e p r o j e c t o n G i t H u b )

remote

Page 9: Yes, you can git!

P E A C E F U L

Page 10: Yes, you can git!

G E T T I N G S TA R T E DS E T T I N G U P T O C O N T R I B U T E T O A N O P E N S O U R C E P R O J E C T

Page 11: Yes, you can git!

Fork an open source project

Fork

Copies source from upstream to origin

Page 12: Yes, you can git!

Fork an open source project

O R I G I N ( y o u o n G i t H u b )

U P S T R E A M ( o p e n s o u r c e p r o j e c t o n G i t H u b )

Click

Page 13: Yes, you can git!

Clone your fork of an open source project

to your local computer

git clone <url> git status git remote -v

Page 14: Yes, you can git!

Add a remote Let’s create a nickname of the open source project.

upstream sounds like a good nickname.

git remote -v git remote add upstream <url> git remote -v

Page 15: Yes, you can git!

Fork an open source project

Clone your fork

of an open source project

~/myprojects/wsc-music

https://github.com/<you>/wsc-music

https://github.com/gentlecodegarden/wsc-music

R E V I E W

Page 16: Yes, you can git!

C O N F I D E N T

Page 17: Yes, you can git!

C R E AT I N GL E T ’ S M A K E S O M E T H I N G F O R T H E P R O J E C T

Page 18: Yes, you can git!

fetch, rebase, push my workflow for keeping things updated

git fetch upstream git rebase upstream/master git push origin master

Page 19: Yes, you can git!

branch, checkout A feature branch keeps your new contribution neat and tidy.

Doing work on a feature branch helps avoid merge headaches later.

git branch new-feature git checkout new-feature

git checkout -b new-feature

Page 20: Yes, you can git!

git status Pro tip: use it often.

git status

Page 21: Yes, you can git!

git add Adds file(s) to the staging area to keep ready before committing changes.

Real world analogy: Boarding an airplane

git add <file(s)> git status

Page 22: Yes, you can git!

git commit Commit file(s) in the staging area to the repo history.

Real world analogy: Airplane takes off with all its passengers

git commit -m'Add commit message.' git status git log

Note: The commit exists in the local repo only at this point.

Page 23: Yes, you can git!

git push Shares the local commit with a remote repo.

git push origin new-feature

Note: You must have "push" privileges to push to a remote repo.

Page 24: Yes, you can git!

Another feature Update the local repo with upstream changes.

Create a new feature branch. Update the origin repo.

git checkout master git checkout -b another-feature git fetch upstream git rebase upstream/master git push origin another-feature

Page 25: Yes, you can git!

git add <files> git commit -m"Add commit message" git status git log git fetch upstream git rebase upstream/master git push origin another-feature

• Add changed files to staging area of local repo.

• Commit changed files to local branch and repo.

• Update (fetch and rebase) the local repo with any upstream changes.

• Push feature branch to the origin repo.

Another feature: add, commit, fetch, rebase, push

Page 26: Yes, you can git!

– A N O N Y M O U S W S C A L U M N I

“Wow! Write, Speak, Code changes lives. Remember you can go at your pace, ask questions, make mistakes, learn, and have fun too. Believe.”

Page 27: Yes, you can git!

C O N T R I B U T EY O U R I D E A S M A T T E R . S H A R E T H E M . S U B M I T A P U L L R E Q U E S T.

Page 28: Yes, you can git!

Fact: Some projects are more welcoming and encouraging than others.

Myth: Your talent, potential, and future success are defined by a maintainer’s response to your pull request.

Fact: Your PR may be rejected.

Fact: You may need to make changes based on constructive review comments.

Myth: Maintainers are entitled to belittle a pull request or be crummy to you.

Fact: It’s not you. It’s them. And their loss. Find another project that values your contribution.

L E T ’ S M A K E A P U L L R E Q U E S T

Page 29: Yes, you can git!

P r e s s T h e P u l l R e q u e s t B u t t o nC O N T R I B U T E A P R

Page 30: Yes, you can git!

W r i t e A M e s s a g e A n d S u b m i tC O N T R I B U T E A P R

Page 31: Yes, you can git!

T h e S u b m i t t e d P u l l R e q u e s tC O N T R I B U T E A P R

Page 32: Yes, you can git!

P R O U D

Page 33: Yes, you can git!

P a t i e n c e . M a i n t a i n e r c o m m e n t s o n P R .M A I N TA I N E R R E V I E W S T H E P R

Page 34: Yes, you can git!

C o n g r a t u l a t i o n s O n Yo u r C o n t r i b u t i o n !M A I N TA I N E R M E R G E S T H E P R

Page 35: Yes, you can git!

Y E S , Y O U C A N G I T !

Y O U D I D I T !

Page 36: Yes, you can git!

Thank you.

P H O T O S : C A R O L W I L L I N G , L I N N E A W I L L I N G

Page 37: Yes, you can git!

Y E S , Y O U C A N G I T !I N T R O D U C T I O N T O G I T A N D G I T H U B

Carol Willing@willingcarol GitHub: willingc

W R I T E S P E A K C O D E J U N E 1 7 , 2 0 1 6