Top Banner
A hands-on, brain’s-on introduction to git with Legos. oriented git Amanda Walter June 10, 2015 Make sure your environment is ready! Terminal/ command prompt Git installed ($git - - version) Account on GitHub
23
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Intro to-git-class

A hands-on, brain’s-on introduction to git

with Legos.

Goal oriented git

Amanda WalterJune 10, 2015

Make sure your environment is ready!• Terminal/ command

prompt• Git installed ($git - -

version)• Account on GitHub

Page 2: Intro to-git-class

OC Tanner for the meeting space!&

Nina Zakharenko for inspiration &posting her own presentation on

slideshare!&

Stacie for her dedication and grit for GDI!&

All of you for coming tonight!

Thank you!

Page 3: Intro to-git-class

Everything is awesome…and so is git!

Page 4: Intro to-git-class

Grab some Legos! (And an instruction packet.)

Each person has part of the instruction book and the Legos required to complete your part.

1. At the top of your white paper, write the words from the front of your instructions. Ex: “#5: Form the head”

2. Build your parts.3. At the bottom of the paper, write a short,

concise sentence about what you just built. Ex: “Build the head”

4. Take your paper & Legos to the long table, place them in order.

5. See if anyone needs help!

Page 5: Intro to-git-class

Congratulations!

You just created a branch off a master.Then you made changes within a branch.You committed the changes to the master.The branches were merged into the master branch to complete a project.

Git is more intuitive than you thought!

Page 6: Intro to-git-class

Let’s clone a koanWhy?Koans are exercise sets useful for practicing a new language!

There are koans for just about every language- we will be using JS koans today- but you can search GitHub and find koans in almost every language.

We can learn about GitHub while doing something useful!

Page 7: Intro to-git-class

We are learning:

How to search on GitHub Navigating a repository Forking a repository Cloning to your local

environment Using README files

Page 8: Intro to-git-class

Let’s make a new git project and push it (part

1)!

Why?You can use git to track files on your computer and keep a record of changes to the files

Branches keep your work organized and allow experimenting with different versions of a project

Page 9: Intro to-git-class

We are learning:

How to initialize a git repositoryHow to uninitialize a git repositoryListing the status of a repositoryAdding files to be tracked in gitStaging files to be committedCommitting changes

Page 10: Intro to-git-class

Recap!

Vocabulary• git• GitHub• repository• branch• commit• master• origin• clone• fork

git commands• git clone [url]• git init• git status• git add• git commit –m• git branch• git checkout

Page 11: Intro to-git-class

Let’s make a new git project and push it (part

2)!

Why?Publishing your work to GitHub allows you to work away from your machine and backs up important work!

If you are looking for work in development, GitHub is a valuable resume tool

Page 12: Intro to-git-class

We are learning:

Create a GitHub repository for this project

Connect the local directory and remote repository

Push changes from your local machine to the cloud

Page 13: Intro to-git-class

Psst…here’s the easy way.In GitHub:

① Make a new repo

② Make decisions about README, gitignore and license files.

③ Copy the repo link

In your terminal:

④ Go to the directory of your choice

⑤ $git clone [url pasted here]

⑥ That’s it!

Why don’t we just do it the easy way all the time?

Let’s think of some reasons together.

Page 14: Intro to-git-class

Let’s clone another repo!

Why?Using branches lets you try out new

features and make changes to files, then throw them away if they don’t work

Page 15: Intro to-git-class

We are learning:

How to make a new branchSeeing a list of branchesHow to change branchesDeleting a branch

Page 16: Intro to-git-class

Recap!

Vocabulary• local• remote• gitignore

git commands• git remote

• add upstream [url]

• -v

• git pull

• git push• git fetch• git merge

Page 17: Intro to-git-class

Let’s make some changes!

Why?You will probably want to work with your files!

There may be files you do not want git to track (passwords, sensitive information)

Page 18: Intro to-git-class

We are learning:

How to commit early and often What happens to files as you change branches and merge

How to track/ untrack files How to set up and use a .gitignore file

Page 19: Intro to-git-class

Collaboration 101: git workflow

Page 20: Intro to-git-class

Publish you work in someone else’s repo!

Why?You have improved an open source project, squashed a bug or added a new feature you think the owner of a project may appreciate

We are learning: Pushing from a branch other than master

Creating issuesMaking a pull request

Page 21: Intro to-git-class

Neat things GitHub & git can do(intermediate git commands)

Show changes between commits($ git diff)Identify who made changes ($ git blame)Re-order commits($ git rebase)Set aside fragments of work temporarily, then get them back

($ git stash/ git pop)

Page 22: Intro to-git-class

Recap!

Vocabulary• local• remote• gitignore

git commands• git remote

• add upstream [url]

• -v

• git pull

• git push• git fetch• git merge

Page 23: Intro to-git-class

Additional Learning Resources!

•Use Dropbox as a personal GitHubhttp://jetheis.com/blog/2013/02/17/using-dropbox-as-a-private-github/•Pro Git- the largest book on git I could find…and it’s free!

https://git-scm.com/book/en/v2• Git Immersion- how I learned git, and it was

great!http://gitimmersion.com/index.html