git basics: climbing the totem pole
DESCRIPTION
A basic overview of the Git and GitHub workflow - intended for beginners, but could also be helpful for git users who are shaky on the fundamentalsTRANSCRIPT
![Page 1: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/1.jpg)
© Matthew Salerno, 2012
Git Basics: Climbing the Totem Pole
by Matthew SalernoGithub: https://github.com/seldomatt
Twitter:@seldomattLinkedin: http://www.linkedin.com/pub/matthew-salerno/9/62b/584
![Page 2: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/2.jpg)
© Matthew Salerno, 2012
Git vs. Github
![Page 3: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/3.jpg)
© Matthew Salerno, 2012
Git vs. Github
GIT• Revision control and source
code management system
![Page 4: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/4.jpg)
© Matthew Salerno, 2012
Git vs. Github
GIT• Revision control and source
code management system • Created by Linus Torvalds
(Linux) in 2005
![Page 5: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/5.jpg)
© Matthew Salerno, 2012
Git vs. Github
GIT• Revision control and source
code management system • Created by Linus Torvalds
(Linux) in 2005
GITHUB• Hosting service for software
projects that use Git
![Page 6: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/6.jpg)
© Matthew Salerno, 2012
Git vs. Github
GIT• Revision control and source
code management system • Created by Linus Torvalds
(Linux) in 2005
GITHUB• Hosting service for software
projects that use Git• Started in 2008, now 1m+
users
![Page 7: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/7.jpg)
© Matthew Salerno, 2012
Git vs. Github
• GitHub – has a graphical user interface
![Page 8: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/8.jpg)
© Matthew Salerno, 2012
Git vs. Github
• GitHub
![Page 9: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/9.jpg)
© Matthew Salerno, 2012
Git vs. Github
• Git – run through the command line
![Page 10: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/10.jpg)
© Matthew Salerno, 2012
Git vs. Github
• Git – run through the command line– Tracks changes to a file or directory by storing
commits (versions) to a local repository
![Page 11: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/11.jpg)
© Matthew Salerno, 2012
Git vs. Github
• Git – run through the command line– Tracks changes to a file or directory by storing
commits (versions) to a local repository– Local changes can be pushed to remote repository
(GitHub)
![Page 12: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/12.jpg)
© Matthew Salerno, 2012
Git vs. Github
• Git – run through the command line– Tracks changes to a file or directory by storing
commits (versions) to a local repository– Local changes can be pushed to remote repository
(GitHub)– Fork/clone projects from remote repositories to
local repos, and much more…
![Page 13: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/13.jpg)
© Matthew Salerno, 2012
Git vs. Github
• Git
![Page 14: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/14.jpg)
© Matthew Salerno, 2012
Part of being a programmer isbreaking down complexity into more manageable parts
![Page 15: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/15.jpg)
© Matthew Salerno, 2012
We’re going to try to swallow a manageable, bite-sized portion of Git.
![Page 16: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/16.jpg)
© Matthew Salerno, 2012
What We Will Cover
• Init – creating a local repository
![Page 17: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/17.jpg)
© Matthew Salerno, 2012
What We Will Cover
• Init – creating a local repository• Add – staging changes
![Page 18: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/18.jpg)
© Matthew Salerno, 2012
What We Will Cover
• Init – creating a local repository• Add – staging changes • Commit – commit changes (saves a version)
![Page 19: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/19.jpg)
© Matthew Salerno, 2012
What We Will Cover
• Init – creating a local repository• Add – staging changes • Commit – commit changes (saves a version)• Status/Log – see staged/unstaged changes,
commit history
![Page 20: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/20.jpg)
© Matthew Salerno, 2012
What We Will Cover
• Init – creating a local repository• Add – staging changes • Commit – commit changes (saves a version)• Status/Log – see staged/unstaged changes,
commit history• Push – create a remote repo and push
changes from local repo (GitHub)
![Page 21: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/21.jpg)
© Matthew Salerno, 2012
What We Will Cover
• Init – creating a local repository• Add – staging changes • Commit – commit changes (saves a version)• Status/Log – see staged/unstaged changes,
commit history• Push – create a remote repo and push
changes from local repo (GitHub)• Fork/Clone – work on someone else’s project
![Page 22: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/22.jpg)
© Matthew Salerno, 2012
What We Won’t Cover
• Installing Git
![Page 23: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/23.jpg)
© Matthew Salerno, 2012
What We Won’t Cover
• Installing Git • Branching, merging, and a host of other
operations that would be central to using git to manage professional projects
![Page 24: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/24.jpg)
© Matthew Salerno, 2012
GIT: BUILDING THE TOTEM POLE
![Page 25: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/25.jpg)
© Matthew Salerno, 2012
WORKING TREE
![Page 26: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/26.jpg)
© Matthew Salerno, 2012
WORKING TREE
• Files and directories that the user alters in an editor or otherwise (example.rb, ‘rails_app’ directory)
![Page 27: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/27.jpg)
© Matthew Salerno, 2012
WORKING TREE
• Files and directories that the user alters in an editor or otherwise (example.rb, ‘rails_app’ directory)
• ACTIONS:– WRITE CODE– DELETE CODE– SAVE (LOCALLY)
![Page 28: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/28.jpg)
© Matthew Salerno, 2012
Local Repository
![Page 29: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/29.jpg)
© Matthew Salerno, 2012
Local Repository
The local repository is where git stores versions, or commits, of your working tree
![Page 30: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/30.jpg)
© Matthew Salerno, 2012
Let’s create a local git repository
• From the command line, navigate to our working tree directory
![Page 31: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/31.jpg)
© Matthew Salerno, 2012
Let’s create a local git repository
• From the command line, navigate to our working tree directory
• Run ‘git init’ command/working tree $ git init .
![Page 32: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/32.jpg)
© Matthew Salerno, 2012
Working Tree
![Page 33: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/33.jpg)
© Matthew Salerno, 2012
Working Tree
Local Repository
![Page 34: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/34.jpg)
© Matthew Salerno, 2012
Working Tree
Local Repository
What’s Missing?
![Page 35: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/35.jpg)
© Matthew Salerno, 2012
Index/Staging Area
![Page 36: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/36.jpg)
© Matthew Salerno, 2012
Index/Staging Area
Index is a collection of changes to the working tree waiting to be saved to the repository as a
commit
![Page 37: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/37.jpg)
© Matthew Salerno, 2012
Index/Staging Area
Index is a collection of changes to the working tree waiting to be saved to the repository as a
commit
(the On-Deck circle of working tree changes)
![Page 38: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/38.jpg)
© Matthew Salerno, 2012
Index/Staging Area
When we make changes to the working tree, we add them to the index(staging area) with the ‘git
add’ command
![Page 39: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/39.jpg)
© Matthew Salerno, 2012
Git Add
• Make some changes to the working tree
![Page 40: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/40.jpg)
© Matthew Salerno, 2012
Git Add
• Make some changes to the working tree• /working tree $ git add .
![Page 41: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/41.jpg)
© Matthew Salerno, 2012
Git Add
Our index is now a snapshot of our working tree in it’s current state
![Page 42: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/42.jpg)
© Matthew Salerno, 2012
Git Add
We can keep ‘git add’-ing changes to update the index
![Page 43: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/43.jpg)
© Matthew Salerno, 2012
Git Add
• Added changes are ‘staged’. Changes to the working tree that have not been added to the index are ‘unstaged’
![Page 44: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/44.jpg)
© Matthew Salerno, 2012
Git Add
• Added changes are ‘staged’. Changes to the working tree that have not been added to the index are ‘unstaged’
• $ git status will show us what changes have been staged and which have not
![Page 45: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/45.jpg)
© Matthew Salerno, 2012
Eventually, we’ll come to a point where we want to save a version of our working tree
in it’s current state.
![Page 46: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/46.jpg)
© Matthew Salerno, 2012
COMMIT
![Page 47: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/47.jpg)
© Matthew Salerno, 2012
COMMIT
• A commit is a saved version (snapshot) of the working tree
![Page 48: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/48.jpg)
© Matthew Salerno, 2012
COMMIT
• A commit is a saved version (snapshot) of the working tree
• when git commit is executed, all ‘staged changes’, i.e. the current index, are saved to the local repo.
![Page 49: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/49.jpg)
© Matthew Salerno, 2012
COMMIT
• A commit is a saved version (snapshot) of the working tree
• when git commit is executed, all ‘staged changes’, i.e. the current index, are saved to the local repo.
• the index is then cleared out, making room for future changes to be staged and saved to the local repo as future commits
![Page 50: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/50.jpg)
© Matthew Salerno, 2012
COMMIT
• $ git status . to make sure all changes are staged
![Page 51: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/51.jpg)
© Matthew Salerno, 2012
COMMIT
• $ git status . to make sure all changes are staged
• $ git commit –m ‘commit message’
![Page 52: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/52.jpg)
© Matthew Salerno, 2012
COMMIT
If we leave off the –m tag, git will open VIM, PICO, or whatever editor it can find in our bash
settings to enter a commit message
![Page 53: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/53.jpg)
© Matthew Salerno, 2012
COMMIT
If we leave off the –m tag, git will open VIM, PICO, or whatever editor it can find in our bash
settings to enter a commit message
Don’t forget the –m tag!
![Page 54: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/54.jpg)
© Matthew Salerno, 2012
COMMIT
• git commit records the snapshot(index) of all staged content to the local repository
![Page 55: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/55.jpg)
© Matthew Salerno, 2012
COMMIT
• git commit records the snapshot(index) of all staged content to the local repository
• Each commit is uniquely identified
![Page 56: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/56.jpg)
© Matthew Salerno, 2012
COMMIT
• git commit records the snapshot(index) of all staged content to the local repository
• Each commit is uniquely identified • The commit can now be compared, shared, or
reverted to if necessary
![Page 57: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/57.jpg)
© Matthew Salerno, 2012
RECAP
![Page 58: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/58.jpg)
© Matthew Salerno, 2012
RECAP
Working Tree • Write, Delete, Save• Local Drive
![Page 59: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/59.jpg)
© Matthew Salerno, 2012
RECAP
Working Tree • Write, Delete, Save• Local Drive
Index• Snapshot of the working tree • $ git add stages by updating the index
![Page 60: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/60.jpg)
© Matthew Salerno, 2012
RECAP
Working Tree • Write, Delete, Save• Local Drive
Index• Snapshot of the working tree • $ git add stages by updating the index
Local Repository• Local repository stores commits
(versions) of the working tree• $ git commit saves all staged changes
(index) to local repo
![Page 61: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/61.jpg)
© Matthew Salerno, 2012
Now we want to share with the world…
![Page 62: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/62.jpg)
© Matthew Salerno, 2012
Remote Repo
![Page 63: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/63.jpg)
© Matthew Salerno, 2012
Remote Repo
Step #1 – Create a remote repository
![Page 64: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/64.jpg)
© Matthew Salerno, 2012
Remote Repo
Github will give you a URL for that repository, i.e.
[email protected]:username/reponame.git
![Page 65: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/65.jpg)
© Matthew Salerno, 2012
Remote Repo
Step #2 – synchronize between local and remote repo
![Page 66: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/66.jpg)
© Matthew Salerno, 2012
Remote Repo
• $ git remote add
![Page 67: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/67.jpg)
© Matthew Salerno, 2012
Remote Repo
• $ git remote add– Allows us to set up an alias for our remote repo
![Page 68: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/68.jpg)
© Matthew Salerno, 2012
Remote Repo
• $ git remote add– Allows us to set up an alias for our remote repo– $ git remote add [alias] [email protected]:
[username]/[reponame].git
![Page 69: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/69.jpg)
© Matthew Salerno, 2012
PUSH!
Step #3 – push commits from local repo to remote repo
![Page 70: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/70.jpg)
© Matthew Salerno, 2012
PUSH!
• $ git push [alias] [branch]
![Page 71: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/71.jpg)
© Matthew Salerno, 2012
PUSH!
• $ git push [alias] [branch]– We’ll use master as our branch, but you could
push from any number of branches
![Page 72: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/72.jpg)
© Matthew Salerno, 2012
PUSH!
• $ git push [alias] [branch]– We’ll use master as our branch, but you could
push from any number of branches– $ git push basic master
![Page 73: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/73.jpg)
© Matthew Salerno, 2012
PUSH!
We’ve now successfully pushed our commit from the local repo to the remote repo.
![Page 74: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/74.jpg)
© Matthew Salerno, 2012
PUSH!
We’ve now successfully pushed our commit from the local repo to the remote repo.
![Page 75: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/75.jpg)
© Matthew Salerno, 2012
What if we want to work on someone else’s code?
![Page 76: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/76.jpg)
© Matthew Salerno, 2012
FORK/CLONE
![Page 77: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/77.jpg)
© Matthew Salerno, 2012
FORK
![Page 78: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/78.jpg)
© Matthew Salerno, 2012
FORK
In forking someone’s else’s project repo, you are creating a new remote repository with identical
contents…
![Page 79: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/79.jpg)
© Matthew Salerno, 2012
FORK
…but a forked repo only exists on github. To work on the project, we need to clone the repo
to our local machine…
![Page 80: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/80.jpg)
© Matthew Salerno, 2012
CLONE
![Page 81: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/81.jpg)
© Matthew Salerno, 2012
CLONE
$ git clone https://github.com/username/reponame.git
![Page 82: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/82.jpg)
© Matthew Salerno, 2012
CLONE
Now we can interact with the cloned repo as we would any other (adding, commiting, pushing)
![Page 83: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/83.jpg)
© Matthew Salerno, 2012
CLONE
We can also configure remote aliases pointing to the original forked repo to keep track of updates
to the original project, pull from the original repo, merge with our own files, etc.
![Page 84: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/84.jpg)
© Matthew Salerno, 2012
CONCLUSION/RESOURCESTHE TOTEM POLE IS COMPLETE…
![Page 85: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/85.jpg)
© Matthew Salerno, 2012
BASIC WORKFLOW
![Page 86: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/86.jpg)
© Matthew Salerno, 2012
BASIC WORKFLOW
• Creating a local repo (init)
![Page 87: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/87.jpg)
© Matthew Salerno, 2012
BASIC WORKFLOW
• Creating a local repo (init)• Snapshotting (add)
![Page 88: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/88.jpg)
© Matthew Salerno, 2012
BASIC WORKFLOW
• Creating a local repo (init)• Snapshotting (add)• Commits (commit)
![Page 89: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/89.jpg)
© Matthew Salerno, 2012
BASIC WORKFLOW
• Creating a local repo (init)• Snapshotting (add)• Commits (commit) • Remote repo (remote add, push)
![Page 90: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/90.jpg)
© Matthew Salerno, 2012
BASIC WORKFLOW
• Creating a local repo (init)• Snapshotting (add)• Commits (commit) • Remote repo (remote add, push)• Interaction (fork, clone)
![Page 91: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/91.jpg)
© Matthew Salerno, 2012
THERE’S MUCH, MUCH MORE
• Resources– GitHub• http://help.github.com
– GitReference• http://gitref.org
– Code School – Try Git• http://try.github.com
![Page 92: Git Basics: Climbing the Totem Pole](https://reader033.vdocuments.mx/reader033/viewer/2022061218/54b7b88e4a7959c9688b4757/html5/thumbnails/92.jpg)
© Matthew Salerno, 2012
GOOD LUCK!