SlideShare a Scribd company logo
1 of 92
Git Basics: Climbing the Totem
              Pole
              by Matthew Salerno
                    Github: https://github.com/seldomatt
                             Twitter:@seldomatt
    Linkedin: http://www.linkedin.com/pub/matthew-salerno/9/62b/584




                         © Matthew Salerno, 2012
Git vs. Github




   © Matthew Salerno, 2012
Git vs. Github
GIT
• Revision control and source
  code management system




                        © Matthew Salerno, 2012
Git vs. Github
GIT
• Revision control and source
  code management system
• Created by Linus Torvalds
  (Linux) in 2005




                        © Matthew Salerno, 2012
Git vs. Github
GIT                                  GITHUB
• Revision control and source        • Hosting service for software
  code management system               projects that use Git
• Created by Linus Torvalds
  (Linux) in 2005




                        © Matthew Salerno, 2012
Git vs. Github
GIT                                  GITHUB
• Revision control and source        • Hosting service for software
  code management system               projects that use Git
• Created by Linus Torvalds          • Started in 2008, now 1m+
  (Linux) in 2005                      users




                        © Matthew Salerno, 2012
Git vs. Github
• GitHub
  – has a graphical user interface




                     © Matthew Salerno, 2012
Git vs. Github
• GitHub




              © Matthew Salerno, 2012
Git vs. Github
• Git
  – run through the command line




                   © 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




                      © 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)




                    © 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…


                    © Matthew Salerno, 2012
Git vs. Github
• Git




           © Matthew Salerno, 2012
Part of being a programmer is
breaking down complexity into more
         manageable parts




             © Matthew Salerno, 2012
We’re going to try to swallow a
manageable, bite-sized portion of Git.




               © Matthew Salerno, 2012
What We Will Cover
• Init – creating a local repository




                    © Matthew Salerno, 2012
What We Will Cover
• Init – creating a local repository
• Add – staging changes




                    © Matthew Salerno, 2012
What We Will Cover
• Init – creating a local repository
• Add – staging changes
• Commit – commit changes (saves a version)




                  © 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




                    © 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)


                  © 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
                  © Matthew Salerno, 2012
What We Won’t Cover
• Installing Git




                   © 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




                   © Matthew Salerno, 2012
GIT: BUILDING THE
TOTEM POLE

            © Matthew Salerno, 2012
WORKING TREE




   © Matthew Salerno, 2012
WORKING TREE
• Files and directories that the user alters in an
  editor or otherwise (example.rb, ‘rails_app’
  directory)




                    © 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)



                     © Matthew Salerno, 2012
Local Repository




    © Matthew Salerno, 2012
Local Repository
The local repository is where git stores versions,
       or commits, of your working tree




                   © Matthew Salerno, 2012
Let’s create a local git repository
• From the command line, navigate to our
  working tree directory




                  © 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 .




                      © Matthew Salerno, 2012
Working Tree



© Matthew Salerno, 2012
Local Repository




                           Working Tree



© Matthew Salerno, 2012
Local Repository




What’s Missing? 

                                               Working Tree



                    © Matthew Salerno, 2012
Index/Staging Area




     © 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




                  © 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)




                  © 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




                   © Matthew Salerno, 2012
Git Add
• Make some changes to the working tree




                  © Matthew Salerno, 2012
Git Add
• Make some changes to the working tree
• /working tree $ git add .




                  © Matthew Salerno, 2012
Git Add

Our index is now a snapshot of our working tree
               in it’s current state




                  © Matthew Salerno, 2012
Git Add

We can keep ‘git add’-ing changes to update the
                     index




                  © Matthew Salerno, 2012
Git Add
• Added changes are ‘staged’. Changes to the
  working tree that have not been added to the
  index are ‘unstaged’




                  © 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




                  © 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.




                © Matthew Salerno, 2012
COMMIT




© Matthew Salerno, 2012
COMMIT
• A commit is a saved version (snapshot) of the
  working tree




                   © 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.




                   © 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

                   © Matthew Salerno, 2012
COMMIT
• $ git status . to make sure all changes are
  staged




                    © Matthew Salerno, 2012
COMMIT
• $ git status . to make sure all changes are
  staged
• $ git commit –m ‘commit message’




                    © 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




                  © 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!

                  © Matthew Salerno, 2012
COMMIT
• git commit records the snapshot(index) of all
  staged content to the local repository




                   © Matthew Salerno, 2012
COMMIT
• git commit records the snapshot(index) of all
  staged content to the local repository
• Each commit is uniquely identified




                   © 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




                   © Matthew Salerno, 2012
RECAP




© Matthew Salerno, 2012
RECAP




          Working Tree
              • Write, Delete, Save
              • Local Drive




© Matthew Salerno, 2012
RECAP



          Index
              • Snapshot of the working tree
              • $ git add stages by updating the index

          Working Tree
             • Write, Delete, Save
             • Local Drive




© Matthew Salerno, 2012
RECAP
         Local Repository
              • Local repository stores commits
                 (versions) of the working tree
              • $ git commit saves all staged changes
                 (index) to local repo

          Index
              • Snapshot of the working tree
              • $ git add stages by updating the index

          Working Tree
             • Write, Delete, Save
             • Local Drive




© Matthew Salerno, 2012
Now we want to share with the
world…




              © Matthew Salerno, 2012
Remote Repo




  © Matthew Salerno, 2012
Remote Repo
Step #1 – Create a remote repository




             © Matthew Salerno, 2012
Remote Repo

Github will give you a URL for that repository,
                      i.e.
   git@github.com:username/reponame.git




                  © Matthew Salerno, 2012
Remote Repo

Step #2 – synchronize between local and remote
                     repo




                  © Matthew Salerno, 2012
Remote Repo
• $ git remote add




                     © Matthew Salerno, 2012
Remote Repo
• $ git remote add
  – Allows us to set up an alias for our remote repo




                     © Matthew Salerno, 2012
Remote Repo
• $ git remote add
  – Allows us to set up an alias for our remote repo
  – $ git remote add [alias]
    git@github.com:[username]/[reponame].git




                     © Matthew Salerno, 2012
PUSH!
Step #3 – push commits from local repo to
              remote repo




               © Matthew Salerno, 2012
PUSH!
• $ git push [alias] [branch]




                    © Matthew Salerno, 2012
PUSH!
• $ git push [alias] [branch]
  – We’ll use master as our branch, but you could
    push from any number of branches




                    © 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




                    © Matthew Salerno, 2012
PUSH!
We’ve now successfully pushed our commit from
the local repo to the remote repo.




                 © Matthew Salerno, 2012
PUSH!
We’ve now successfully pushed our commit from
the local repo to the remote repo.




                 © Matthew Salerno, 2012
What if we want to work on someone
            else’s code?




             © Matthew Salerno, 2012
FORK/CLONE




  © Matthew Salerno, 2012
FORK




© Matthew Salerno, 2012
FORK

In forking someone’s else’s project repo, you are
 creating a new remote repository with identical
                   contents…




                   © 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…




                  © Matthew Salerno, 2012
CLONE




© Matthew Salerno, 2012
CLONE
$ git clone
https://github.com/username/reponame.git




                 © Matthew Salerno, 2012
CLONE

Now we can interact with the cloned repo as we
 would any other (adding, commiting, pushing)




                  © 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.




                   © Matthew Salerno, 2012
THE TOTEM POLE IS COMPLETE…

CONCLUSION/RESOURCES


                       © Matthew Salerno, 2012
BASIC WORKFLOW




    © Matthew Salerno, 2012
BASIC WORKFLOW
• Creating a local repo (init)




                    © Matthew Salerno, 2012
BASIC WORKFLOW
• Creating a local repo (init)
• Snapshotting (add)




                    © Matthew Salerno, 2012
BASIC WORKFLOW
• Creating a local repo (init)
• Snapshotting (add)
• Commits (commit)




                    © Matthew Salerno, 2012
BASIC WORKFLOW
•   Creating a local repo (init)
•   Snapshotting (add)
•   Commits (commit)
•   Remote repo (remote add, push)




                   © Matthew Salerno, 2012
BASIC WORKFLOW
•   Creating a local repo (init)
•   Snapshotting (add)
•   Commits (commit)
•   Remote repo (remote add, push)
•   Interaction (fork, clone)




                   © 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




                           © Matthew Salerno, 2012
GOOD LUCK!




 © Matthew Salerno, 2012

More Related Content

Viewers also liked

Viewers also liked (16)

Cloud 서비스
Cloud 서비스Cloud 서비스
Cloud 서비스
 
28 xunho ud_secundaria
28 xunho ud_secundaria28 xunho ud_secundaria
28 xunho ud_secundaria
 
Mulleres artistas
Mulleres artistasMulleres artistas
Mulleres artistas
 
Emerging Mobile Trends & Behaviors for 2013
Emerging Mobile Trends & Behaviors for 2013Emerging Mobile Trends & Behaviors for 2013
Emerging Mobile Trends & Behaviors for 2013
 
소셜Pr
소셜Pr소셜Pr
소셜Pr
 
[DDBJing31] BioProject, BioSample, DDBJ Sequence Read Archive の紹介
[DDBJing31] BioProject, BioSample, DDBJ Sequence Read Archive の紹介[DDBJing31] BioProject, BioSample, DDBJ Sequence Read Archive の紹介
[DDBJing31] BioProject, BioSample, DDBJ Sequence Read Archive の紹介
 
Ads
AdsAds
Ads
 
影像好日子隨手拍
影像好日子隨手拍 影像好日子隨手拍
影像好日子隨手拍
 
Pathang
PathangPathang
Pathang
 
Incredible mankind
Incredible mankindIncredible mankind
Incredible mankind
 
Present rec 03_tor
Present rec 03_torPresent rec 03_tor
Present rec 03_tor
 
Cloud
CloudCloud
Cloud
 
Curset 2
Curset 2Curset 2
Curset 2
 
Lalalalalallalaa
LalalalalallalaaLalalalalallalaa
Lalalalalallalaa
 
Developing the next generation of Real Time Optimization Technologies (Blend ...
Developing the next generation of Real Time Optimization Technologies (Blend ...Developing the next generation of Real Time Optimization Technologies (Blend ...
Developing the next generation of Real Time Optimization Technologies (Blend ...
 
Greece
GreeceGreece
Greece
 

Similar to Git Basics: Climbing the Totem Pole

HPLN Meet Git - Public
HPLN Meet Git - PublicHPLN Meet Git - Public
HPLN Meet Git - PublicLiran Tal
 
Processes & tooling to develop the editor
Processes & tooling to develop the editorProcesses & tooling to develop the editor
Processes & tooling to develop the editorTech Head Brothers
 
Let's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubLet's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubKim Moir
 
Don't Let Git Get Your Goat!
Don't Let Git Get Your Goat!Don't Let Git Get Your Goat!
Don't Let Git Get Your Goat!CollabNet
 
Git walkthrough
Git walkthroughGit walkthrough
Git walkthroughBimal Jain
 
Getting Started with Git and GitHub
Getting Started with Git and GitHubGetting Started with Git and GitHub
Getting Started with Git and GitHubRabiraj Khadka
 
Essential git for developers
Essential git for developersEssential git for developers
Essential git for developersAidan Casey
 
Git the easy way
Git the easy wayGit the easy way
Git the easy wayJoe Morgan
 
Bitbucket as a code server and pmt
Bitbucket as a code server and pmt Bitbucket as a code server and pmt
Bitbucket as a code server and pmt malike4u
 
Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14
Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14
Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14msohn
 

Similar to Git Basics: Climbing the Totem Pole (20)

Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
 
HPLN Meet Git - Public
HPLN Meet Git - PublicHPLN Meet Git - Public
HPLN Meet Git - Public
 
Git workshop
Git workshopGit workshop
Git workshop
 
Processes & tooling to develop the editor
Processes & tooling to develop the editorProcesses & tooling to develop the editor
Processes & tooling to develop the editor
 
GIT.pptx
GIT.pptxGIT.pptx
GIT.pptx
 
Let's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubLet's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHub
 
Don't Let Git Get Your Goat!
Don't Let Git Get Your Goat!Don't Let Git Get Your Goat!
Don't Let Git Get Your Goat!
 
Learn Git Basics
Learn Git BasicsLearn Git Basics
Learn Git Basics
 
git.ppt.pdf
git.ppt.pdfgit.ppt.pdf
git.ppt.pdf
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Session git
Session gitSession git
Session git
 
Git walkthrough
Git walkthroughGit walkthrough
Git walkthrough
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
 
Getting Started with Git and GitHub
Getting Started with Git and GitHubGetting Started with Git and GitHub
Getting Started with Git and GitHub
 
Essential git for developers
Essential git for developersEssential git for developers
Essential git for developers
 
GIT In Detail
GIT In DetailGIT In Detail
GIT In Detail
 
Git the easy way
Git the easy wayGit the easy way
Git the easy way
 
Git Overview
Git OverviewGit Overview
Git Overview
 
Bitbucket as a code server and pmt
Bitbucket as a code server and pmt Bitbucket as a code server and pmt
Bitbucket as a code server and pmt
 
Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14
Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14
Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14
 

Recently uploaded

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 

Recently uploaded (20)

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

Git Basics: Climbing the Totem Pole

  • 1. Git Basics: Climbing the Totem Pole by Matthew Salerno Github: https://github.com/seldomatt Twitter:@seldomatt Linkedin: http://www.linkedin.com/pub/matthew-salerno/9/62b/584 © Matthew Salerno, 2012
  • 2. Git vs. Github © Matthew Salerno, 2012
  • 3. Git vs. Github GIT • Revision control and source code management system © Matthew Salerno, 2012
  • 4. Git vs. Github GIT • Revision control and source code management system • Created by Linus Torvalds (Linux) in 2005 © Matthew Salerno, 2012
  • 5. Git vs. Github GIT GITHUB • Revision control and source • Hosting service for software code management system projects that use Git • Created by Linus Torvalds (Linux) in 2005 © Matthew Salerno, 2012
  • 6. Git vs. Github GIT GITHUB • Revision control and source • Hosting service for software code management system projects that use Git • Created by Linus Torvalds • Started in 2008, now 1m+ (Linux) in 2005 users © Matthew Salerno, 2012
  • 7. Git vs. Github • GitHub – has a graphical user interface © Matthew Salerno, 2012
  • 8. Git vs. Github • GitHub © Matthew Salerno, 2012
  • 9. Git vs. Github • Git – run through the command line © Matthew Salerno, 2012
  • 10. Git vs. Github • Git – run through the command line – Tracks changes to a file or directory by storing commits (versions) to a local repository © Matthew Salerno, 2012
  • 11. 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) © Matthew Salerno, 2012
  • 12. 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… © Matthew Salerno, 2012
  • 13. Git vs. Github • Git © Matthew Salerno, 2012
  • 14. Part of being a programmer is breaking down complexity into more manageable parts © Matthew Salerno, 2012
  • 15. We’re going to try to swallow a manageable, bite-sized portion of Git. © Matthew Salerno, 2012
  • 16. What We Will Cover • Init – creating a local repository © Matthew Salerno, 2012
  • 17. What We Will Cover • Init – creating a local repository • Add – staging changes © Matthew Salerno, 2012
  • 18. What We Will Cover • Init – creating a local repository • Add – staging changes • Commit – commit changes (saves a version) © Matthew Salerno, 2012
  • 19. 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 © Matthew Salerno, 2012
  • 20. 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) © Matthew Salerno, 2012
  • 21. 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 © Matthew Salerno, 2012
  • 22. What We Won’t Cover • Installing Git © Matthew Salerno, 2012
  • 23. 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 © Matthew Salerno, 2012
  • 24. GIT: BUILDING THE TOTEM POLE © Matthew Salerno, 2012
  • 25. WORKING TREE © Matthew Salerno, 2012
  • 26. WORKING TREE • Files and directories that the user alters in an editor or otherwise (example.rb, ‘rails_app’ directory) © Matthew Salerno, 2012
  • 27. 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) © Matthew Salerno, 2012
  • 28. Local Repository © Matthew Salerno, 2012
  • 29. Local Repository The local repository is where git stores versions, or commits, of your working tree © Matthew Salerno, 2012
  • 30. Let’s create a local git repository • From the command line, navigate to our working tree directory © Matthew Salerno, 2012
  • 31. 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 . © Matthew Salerno, 2012
  • 32. Working Tree © Matthew Salerno, 2012
  • 33. Local Repository Working Tree © Matthew Salerno, 2012
  • 34. Local Repository What’s Missing?  Working Tree © Matthew Salerno, 2012
  • 35. Index/Staging Area © Matthew Salerno, 2012
  • 36. Index/Staging Area Index is a collection of changes to the working tree waiting to be saved to the repository as a commit © Matthew Salerno, 2012
  • 37. 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) © Matthew Salerno, 2012
  • 38. Index/Staging Area When we make changes to the working tree, we add them to the index(staging area) with the ‘git add’ command © Matthew Salerno, 2012
  • 39. Git Add • Make some changes to the working tree © Matthew Salerno, 2012
  • 40. Git Add • Make some changes to the working tree • /working tree $ git add . © Matthew Salerno, 2012
  • 41. Git Add Our index is now a snapshot of our working tree in it’s current state © Matthew Salerno, 2012
  • 42. Git Add We can keep ‘git add’-ing changes to update the index © Matthew Salerno, 2012
  • 43. Git Add • Added changes are ‘staged’. Changes to the working tree that have not been added to the index are ‘unstaged’ © Matthew Salerno, 2012
  • 44. 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 © Matthew Salerno, 2012
  • 45. Eventually, we’ll come to a point where we want to save a version of our working tree in it’s current state. © Matthew Salerno, 2012
  • 47. COMMIT • A commit is a saved version (snapshot) of the working tree © Matthew Salerno, 2012
  • 48. 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. © Matthew Salerno, 2012
  • 49. 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 © Matthew Salerno, 2012
  • 50. COMMIT • $ git status . to make sure all changes are staged © Matthew Salerno, 2012
  • 51. COMMIT • $ git status . to make sure all changes are staged • $ git commit –m ‘commit message’ © Matthew Salerno, 2012
  • 52. 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 © Matthew Salerno, 2012
  • 53. 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! © Matthew Salerno, 2012
  • 54. COMMIT • git commit records the snapshot(index) of all staged content to the local repository © Matthew Salerno, 2012
  • 55. COMMIT • git commit records the snapshot(index) of all staged content to the local repository • Each commit is uniquely identified © Matthew Salerno, 2012
  • 56. 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 © Matthew Salerno, 2012
  • 58. RECAP Working Tree • Write, Delete, Save • Local Drive © Matthew Salerno, 2012
  • 59. RECAP Index • Snapshot of the working tree • $ git add stages by updating the index Working Tree • Write, Delete, Save • Local Drive © Matthew Salerno, 2012
  • 60. RECAP Local Repository • Local repository stores commits (versions) of the working tree • $ git commit saves all staged changes (index) to local repo Index • Snapshot of the working tree • $ git add stages by updating the index Working Tree • Write, Delete, Save • Local Drive © Matthew Salerno, 2012
  • 61. Now we want to share with the world… © Matthew Salerno, 2012
  • 62. Remote Repo © Matthew Salerno, 2012
  • 63. Remote Repo Step #1 – Create a remote repository © Matthew Salerno, 2012
  • 64. Remote Repo Github will give you a URL for that repository, i.e. git@github.com:username/reponame.git © Matthew Salerno, 2012
  • 65. Remote Repo Step #2 – synchronize between local and remote repo © Matthew Salerno, 2012
  • 66. Remote Repo • $ git remote add © Matthew Salerno, 2012
  • 67. Remote Repo • $ git remote add – Allows us to set up an alias for our remote repo © Matthew Salerno, 2012
  • 68. Remote Repo • $ git remote add – Allows us to set up an alias for our remote repo – $ git remote add [alias] git@github.com:[username]/[reponame].git © Matthew Salerno, 2012
  • 69. PUSH! Step #3 – push commits from local repo to remote repo © Matthew Salerno, 2012
  • 70. PUSH! • $ git push [alias] [branch] © Matthew Salerno, 2012
  • 71. PUSH! • $ git push [alias] [branch] – We’ll use master as our branch, but you could push from any number of branches © Matthew Salerno, 2012
  • 72. 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 © Matthew Salerno, 2012
  • 73. PUSH! We’ve now successfully pushed our commit from the local repo to the remote repo. © Matthew Salerno, 2012
  • 74. PUSH! We’ve now successfully pushed our commit from the local repo to the remote repo. © Matthew Salerno, 2012
  • 75. What if we want to work on someone else’s code? © Matthew Salerno, 2012
  • 76. FORK/CLONE © Matthew Salerno, 2012
  • 78. FORK In forking someone’s else’s project repo, you are creating a new remote repository with identical contents… © Matthew Salerno, 2012
  • 79. FORK …but a forked repo only exists on github. To work on the project, we need to clone the repo to our local machine… © Matthew Salerno, 2012
  • 82. CLONE Now we can interact with the cloned repo as we would any other (adding, commiting, pushing) © Matthew Salerno, 2012
  • 83. 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. © Matthew Salerno, 2012
  • 84. THE TOTEM POLE IS COMPLETE… CONCLUSION/RESOURCES © Matthew Salerno, 2012
  • 85. BASIC WORKFLOW © Matthew Salerno, 2012
  • 86. BASIC WORKFLOW • Creating a local repo (init) © Matthew Salerno, 2012
  • 87. BASIC WORKFLOW • Creating a local repo (init) • Snapshotting (add) © Matthew Salerno, 2012
  • 88. BASIC WORKFLOW • Creating a local repo (init) • Snapshotting (add) • Commits (commit) © Matthew Salerno, 2012
  • 89. BASIC WORKFLOW • Creating a local repo (init) • Snapshotting (add) • Commits (commit) • Remote repo (remote add, push) © Matthew Salerno, 2012
  • 90. BASIC WORKFLOW • Creating a local repo (init) • Snapshotting (add) • Commits (commit) • Remote repo (remote add, push) • Interaction (fork, clone) © Matthew Salerno, 2012
  • 91. THERE’S MUCH, MUCH MORE • Resources – GitHub • http://help.github.com – GitReference • http://gitref.org – Code School – Try Git • http://try.github.com © Matthew Salerno, 2012
  • 92. GOOD LUCK! © Matthew Salerno, 2012

Editor's Notes

  1. Insert drawings of a happy coder and a not so happy coder
  2. Insert graphic of happy coder
  3. Insert drawings of a happy coder and a not so happy coder
  4. Insert drawings of a happy coder and a not so happy coder
  5. Insert drawings of a happy coder and a not so happy coder
  6. Insert drawings of a happy coder and a not so happy coder
  7. Insert graphic of unhappy coder
  8. Picture of hands cutting a big steak with ‘Git’ written on it into a small piece.
  9. An understanding of basic operations, a starting point for a continuous education in using git on personal and professional projects
  10. This system works well, but obviously if we want to track revisions, save our working tree at various points in time, it’s insufficient. So let’s create a local git repository where we can store all of the versions (commits) of our code.
  11. This system works well, but obviously if we want to track revisions, save our working tree at various points in time, it’s insufficient. So let’s create a local git repository where we can store all of the versions (commits) of our code.
  12. This system works well, but obviously if we want to track revisions, save our working tree at various points in time, it’s insufficient. So let’s create a local git repository where we can store all of the versions (commits) of our code.
  13. Now we have a local git repository to store our commits (versions).
  14. Now we have a local git repository to store our commits (versions).
  15. Now we have a local git repository to store our commits (versions).
  16. Now we have a local git repository to store our commits (versions).
  17. Insert working tree totem
  18. Insert working tree totem
  19. Insert working tree totem
  20. Add a graphic with the totem pole completed
  21. Add a graphic with the totem pole completed
  22. Add a graphic with the totem pole completed
  23. Add graphic with new piece on the totem pole
  24. Add graphic with new piece on the totem pole
  25. Add graphic with new piece on the totem pole
  26. Add graphic with new piece on the totem pole
  27. Add graphic with new piece on the totem pole
  28. Add graphic with new piece on the totem pole
  29. Add graphic with new piece on the totem pole
  30. Add graphic with new piece on the totem pole
  31. Add graphic with new piece on the totem pole
  32. Add graphic with new piece on the totem pole
  33. Add graphics building the totem pole from working tree, to staging area, to commit (with actions, i.e. change/save, git add, git status, git commit –m)
  34. Add graphics building the totem pole from working tree, to staging area, to commit (with actions, i.e. change/save, git add, git status, git commit –m)
  35. Add graphics building the totem pole from working tree, to staging area, to commit (with actions, i.e. change/save, git add, git status, git commit –m)
  36. Add graphics building the totem pole from working tree, to staging area, to commit (with actions, i.e. change/save, git add, git status, git commit –m)
  37. Graphic?
  38. Add screenhot
  39. Add screenhot
  40. Add screenhot
  41. Mention that can run $git remote, which will show aliases we’ve set up. $ git remote –v will show urls those aliases point to
  42. Mention that can run $git remote, which will show aliases we’ve set up. $ git remote –v will show urls those aliases point to
  43. Mention that can run $git remote, which will show aliases we’ve set up. $ git remote –v will show urls those aliases point to
  44. Mention that can run $git remote, which will show aliases we’ve set up. $ git remote –v will show urls those aliases point to
  45. Insert graphic of fork and clone
  46. Insert screenshot
  47. Insert screenshot
  48. Insert screenshot
  49. Insert screenshot
  50. Insert screenshot
  51. Insert screenshot
  52. Insert screenshot
  53. Add octocat logo