Intro to-git-class
-
Upload
amanda-walter -
Category
Technology
-
view
113 -
download
0
Transcript of 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
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!
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 (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
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
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
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
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
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 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
We are learning:
How to make a new branchSeeing a list of branchesHow to change branchesDeleting a branch
Recap!
Vocabulary• local• remote• gitignore
git commands• git remote
• add upstream [url]
• -v
• git pull
• git push• git fetch• git merge
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 master
Creating issuesMaking a pull request
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)
Recap!
Vocabulary• local• remote• gitignore
git commands• git remote
• add upstream [url]
• -v
• git pull
• git push• git fetch• git merge
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