intro to git & github class

12
A hands-on, brain’s-on introduction to git with Legos. oriented git Amanda Walter June 10, 2015 Please Make sure your environment is ready! Terminal/ command prompt Git installed ($git - - version) Account on GitHub

Upload: amanda-walter

Post on 17-Aug-2015

117 views

Category:

Technology


0 download

TRANSCRIPT

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

with Legos.

Goal oriented git

Amanda WalterJune 10, 2015

PleaseMake sure your environment is ready!• Terminal/ command

prompt• Git installed ($git - -

version)• Account on GitHub

Everything is awesome…and so is git!

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!

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!

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!

We are learning:

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

environment Using README files

Let’s make a new git project and push it!

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

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

We are learning:

How to initialize a git repositoryHow to uninitialize a git repositoryAdding files to be tracked in gitStaging files to be committedCommitting changesCreate a GitHub repositiory for this

projectConnect the local directory and remote

repositoryPush changes from your local machine to

the cloud

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.

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)

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

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 masterCreating issuesMaking a pull request

Collaboration 101: 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)