SlideShare a Scribd company logo
1 of 31
Download to read offline
DrupalCamp, Athens, 12 December 2010




   An intro to Git and
        GitHub
Drupal will be soon hosted at GiHub but before that learn Git for your
                        own good and sanity




                     Panagiotis Papadopoulos
                         6pna / Sfalma
                           @panosjee
Who am I?
Freelancer and startuper wannabe. Athens Ruby and GTUG organiser.
Not a guru in something. Man of all trades master to none with an inclination towards Ruby,
Python, Javascript.
Do not ask me Drupal, but I will help drupalists with www.sfalma.com (shameless promo)
Subversion is the most pointless project
              ever started
            Linus Torvalds
What is Git?
Git is a distributed revision control system with an emphasis on speed. Git
was initially designed and developed by Linus Torvalds for Linux
kernel development.

Every Git working directory is a full-fledged repository with complete history
and full revision tracking capabilities, not dependent on network access or a
central server.

Git's current software maintenance is overseen by Junio Hamano. Git is free
software distributed under the terms of the GNU General Public
License version 2.

If Git is a heavenly tool, GitHub is a programmer 's heaven.

                                                        - PanosJee, December 12th 2010




                                                  Source: http://en.wikipedia.org/wiki/Git_(software)
Git is distributed

panosjee                    jonromero




 savvas                         doxaras
Git is a very simple beast!

Git is:
    Distributed
    Non linear development
    Efficient
        very small footprint
    Consists of Git objects which are the actual data of Git,
    the main thing that the repository is made up of.
    The four main objects of Git are blobs, trees, commits
    and tags.
      A Git object is a file in the repository compressed (with Zlib)
      and referenced by the SHA-1 value of its contents plus a
      small header. The contents of a file are stored as blobs.
The Git model (1)

A simple repo with
the following                                                  Commands
structure:                                                     $ git init .
                                                               $ git add .
                                                               $ git commit -m "first commit"

- module
  - init.php
  -- includes
   - definitions.php
   -- lib
    - model.php




                           Example from the excellent http://peepcode.com/products/git-internals-pdf
The Git model (2)

A simple repo with
the following                                                      Commands
structure:                                                         $ git tag "first tag"
                                                                   $ mkdir validators
                                                                   $ touch email.php
                                                                   $ git add .
- module                                                           $ git commit -m "added validators"

  - init.php
  -- includes
   - definitions.php
   -- lib
    - model.php
    -- validators
     - email.php


                           Example from the excellent http://peepcode.com/products/git-internals-pdf
The Git model (3)
 A simple repo with
 the following
 structure:

 - module
   - init.php
   -- includes
    - definitions.php
    -- lib
     - model.php *
     -- validators
      - email.php

Commands
$ vim model.php
$ git add .
$ git commit -m "include validators"
                                           Example from the excellent http://peepcode.com/products/git-internals-pdf
The Git model (4)
A simple repo with
the following
structure:

- module
  - init.php
  -- includes
   - definitions.php
   -- lib
    - model.php
    -- validators
     - email.php




                           Example from the excellent http://peepcode.com/products/git-internals-pdf
Git is snapshot based
 Multiple parents



      1                              2
                                                   $ git commit -m "new commit"




 Easy branching



      1                            2                                    3

                    $ git commit -m "new commit"
                    $ git branch 4
                                                                       4
Git is snapshot based

                             master
Easy merging
                   2
    1 1        2        3
                                5
                            $ git merge 4


                        4
The virtues of Git
   Fork, Clone, Pull, Remote
Git pull. Full control. Remote repos.




         Made for speed, full visibility in a few lines.
    You can pull from 1-n remote repos. As we said Git is
                         distributed.
Know thy status




 What 's untracked. What 's modified. What 's added. What 's
                 deleted. What 's changed.
Git branches carry their history
Once you clone a Git repo you have complete access to all
previous versions. For ever.
Git stash
Real life scenario.

You are working on your code and your colleagues just pushed
a very important fix that you needed.

You cannot pull changes if you have not commited your code,
but you should not commit as you are still experimenting.

What do you do ?

Just put your changes aside (git stash) get your friends changes
(git pull) and then apply your changes that you had pust aside
(git stash apply).

Neat?
Commit to Open Source in a breeze

The distributed nature of Git   The procedure is simple:
means you can work locally          1.   Find an open source project
                                    2.   Fork it
on code and push to a               3.   Clone (download locally)
remote repository when              4.   Do your changes
ready.                              5.   Push to your remote

This is perfect for teams and   Wanna have your changes
Open Source projects.           merged into initial repo?
                                    1. Do a pull request
                                    2. Hope the author accepts it
$ tools
“The bad workman blames his tools”
 American Proverb
“We shape our tools and afterwards our tools shape us.”
Marshall McLuhan
The best tool you need is to learn the internals of Git you can
understand how it works.

The second best tool is the command line. Master it. You will
never look back.

Git integrates with various IDEs like Eclipse, NetBeans.

There are also great standalone Git apps.
Tower - Mac App - Still beta - Impressive
GitX for Mac - GitK for other platforms
GitWeb - Web UI - Shipped with Git
Giggle - Linux
GitHub is the Facebook of Code

GitHub is an unparallel tool    I am always struck by the
that offers you unlimited       wealth of project I find on
public repos and private        GitHub.
repos on subscriptions plans.   Lots of major open source
                                projects are there for you to
Github is:                      use and study.
 1.   Collaboration tool        Fork them, change them,
 2.   Code host
                                contribute in no time.
 3.   Wiki
 4.   Issue tracker
 5.   Code review tool          If you are a coder and you
 6.   Git UI                    have never used GitHub you
 7.   Social                    probably live in a parallel
                                universe :P
GitHub Network Graph Viewer
Questions?
You may also use Mercurial, Fossil, Bazaar but
    Mercurial and Git are the winners :P

            http://bit.ly/git-dcath

More Related Content

What's hot

What's hot (20)

Git and github
Git and githubGit and github
Git and github
 
Git and Github slides.pdf
Git and Github slides.pdfGit and Github slides.pdf
Git and Github slides.pdf
 
Github
GithubGithub
Github
 
Introduction git
Introduction gitIntroduction git
Introduction git
 
Learning git
Learning gitLearning git
Learning git
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
 
Introducing GitLab
Introducing GitLabIntroducing GitLab
Introducing GitLab
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
 
Introduction To Git
Introduction To GitIntroduction To Git
Introduction To Git
 
Introduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training SessionIntroduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training Session
 
Introduction to git & GitHub
Introduction to git & GitHubIntroduction to git & GitHub
Introduction to git & GitHub
 
Git Started With Git
Git Started With GitGit Started With Git
Git Started With Git
 
GitHub Basics - Derek Bable
GitHub Basics - Derek BableGitHub Basics - Derek Bable
GitHub Basics - Derek Bable
 
What's New for GitLab CI/CD February 2020
What's New for GitLab CI/CD February 2020What's New for GitLab CI/CD February 2020
What's New for GitLab CI/CD February 2020
 
Git & GitHub for Beginners
Git & GitHub for BeginnersGit & GitHub for Beginners
Git & GitHub for Beginners
 
Git real slides
Git real slidesGit real slides
Git real slides
 
Introducing GitLab (September 2018)
Introducing GitLab (September 2018)Introducing GitLab (September 2018)
Introducing GitLab (September 2018)
 
Git and Github Session
Git and Github SessionGit and Github Session
Git and Github Session
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 

Similar to Intro to Git and GitHub

Similar to Intro to Git and GitHub (20)

Git
GitGit
Git
 
Getting started With GIT
Getting started With GITGetting started With GIT
Getting started With GIT
 
16 Git
16 Git16 Git
16 Git
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hub
 
Git hub visualstudiocode
Git hub visualstudiocodeGit hub visualstudiocode
Git hub visualstudiocode
 
Learn Git Fundamentals
Learn Git FundamentalsLearn Git Fundamentals
Learn Git Fundamentals
 
git and github-1.pptx
git and github-1.pptxgit and github-1.pptx
git and github-1.pptx
 
GIT-FirstPart.ppt
GIT-FirstPart.pptGIT-FirstPart.ppt
GIT-FirstPart.ppt
 
Beginner's guide to git and github
Beginner's guide to git and github Beginner's guide to git and github
Beginner's guide to git and github
 
Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?
 
1-Intro to VC & GIT PDF.pptx
1-Intro to VC & GIT PDF.pptx1-Intro to VC & GIT PDF.pptx
1-Intro to VC & GIT PDF.pptx
 
Introduction to git and githhub with practicals.pptx
Introduction to git and githhub with practicals.pptxIntroduction to git and githhub with practicals.pptx
Introduction to git and githhub with practicals.pptx
 
ePOM - Fundamentals of Research Software Development - Code Version Control
ePOM - Fundamentals of Research Software Development - Code Version ControlePOM - Fundamentals of Research Software Development - Code Version Control
ePOM - Fundamentals of Research Software Development - Code Version Control
 
Git presentation
Git presentationGit presentation
Git presentation
 
Git is a distributed version control system .
Git is a distributed version control system .Git is a distributed version control system .
Git is a distributed version control system .
 
Git slides
Git slidesGit slides
Git slides
 
Git 101 Workshop
Git 101 WorkshopGit 101 Workshop
Git 101 Workshop
 
Git essentials
Git essentialsGit essentials
Git essentials
 
Vincit Teatime 2015.2 - Otto Kekäläinen: Don't be a git
Vincit Teatime 2015.2 - Otto Kekäläinen: Don't be a gitVincit Teatime 2015.2 - Otto Kekäläinen: Don't be a git
Vincit Teatime 2015.2 - Otto Kekäläinen: Don't be a git
 
Git best practices workshop
Git best practices workshopGit best practices workshop
Git best practices workshop
 

Intro to Git and GitHub

  • 1. DrupalCamp, Athens, 12 December 2010 An intro to Git and GitHub Drupal will be soon hosted at GiHub but before that learn Git for your own good and sanity Panagiotis Papadopoulos 6pna / Sfalma @panosjee
  • 2. Who am I? Freelancer and startuper wannabe. Athens Ruby and GTUG organiser. Not a guru in something. Man of all trades master to none with an inclination towards Ruby, Python, Javascript. Do not ask me Drupal, but I will help drupalists with www.sfalma.com (shameless promo)
  • 3. Subversion is the most pointless project ever started Linus Torvalds
  • 4. What is Git? Git is a distributed revision control system with an emphasis on speed. Git was initially designed and developed by Linus Torvalds for Linux kernel development. Every Git working directory is a full-fledged repository with complete history and full revision tracking capabilities, not dependent on network access or a central server. Git's current software maintenance is overseen by Junio Hamano. Git is free software distributed under the terms of the GNU General Public License version 2. If Git is a heavenly tool, GitHub is a programmer 's heaven. - PanosJee, December 12th 2010 Source: http://en.wikipedia.org/wiki/Git_(software)
  • 5. Git is distributed panosjee jonromero savvas doxaras
  • 6. Git is a very simple beast! Git is: Distributed Non linear development Efficient very small footprint Consists of Git objects which are the actual data of Git, the main thing that the repository is made up of. The four main objects of Git are blobs, trees, commits and tags. A Git object is a file in the repository compressed (with Zlib) and referenced by the SHA-1 value of its contents plus a small header. The contents of a file are stored as blobs.
  • 7. The Git model (1) A simple repo with the following Commands structure: $ git init . $ git add . $ git commit -m "first commit" - module - init.php -- includes - definitions.php -- lib - model.php Example from the excellent http://peepcode.com/products/git-internals-pdf
  • 8. The Git model (2) A simple repo with the following Commands structure: $ git tag "first tag" $ mkdir validators $ touch email.php $ git add . - module $ git commit -m "added validators" - init.php -- includes - definitions.php -- lib - model.php -- validators - email.php Example from the excellent http://peepcode.com/products/git-internals-pdf
  • 9. The Git model (3) A simple repo with the following structure: - module - init.php -- includes - definitions.php -- lib - model.php * -- validators - email.php Commands $ vim model.php $ git add . $ git commit -m "include validators" Example from the excellent http://peepcode.com/products/git-internals-pdf
  • 10. The Git model (4) A simple repo with the following structure: - module - init.php -- includes - definitions.php -- lib - model.php -- validators - email.php Example from the excellent http://peepcode.com/products/git-internals-pdf
  • 11. Git is snapshot based Multiple parents 1 2 $ git commit -m "new commit" Easy branching 1 2 3 $ git commit -m "new commit" $ git branch 4 4
  • 12. Git is snapshot based master Easy merging 2 1 1 2 3 5 $ git merge 4 4
  • 13. The virtues of Git Fork, Clone, Pull, Remote
  • 14. Git pull. Full control. Remote repos. Made for speed, full visibility in a few lines. You can pull from 1-n remote repos. As we said Git is distributed.
  • 15. Know thy status What 's untracked. What 's modified. What 's added. What 's deleted. What 's changed.
  • 16. Git branches carry their history Once you clone a Git repo you have complete access to all previous versions. For ever.
  • 17. Git stash Real life scenario. You are working on your code and your colleagues just pushed a very important fix that you needed. You cannot pull changes if you have not commited your code, but you should not commit as you are still experimenting. What do you do ? Just put your changes aside (git stash) get your friends changes (git pull) and then apply your changes that you had pust aside (git stash apply). Neat?
  • 18. Commit to Open Source in a breeze The distributed nature of Git The procedure is simple: means you can work locally 1. Find an open source project 2. Fork it on code and push to a 3. Clone (download locally) remote repository when 4. Do your changes ready. 5. Push to your remote This is perfect for teams and Wanna have your changes Open Source projects. merged into initial repo? 1. Do a pull request 2. Hope the author accepts it
  • 19.
  • 20. $ tools “The bad workman blames his tools” American Proverb “We shape our tools and afterwards our tools shape us.” Marshall McLuhan The best tool you need is to learn the internals of Git you can understand how it works. The second best tool is the command line. Master it. You will never look back. Git integrates with various IDEs like Eclipse, NetBeans. There are also great standalone Git apps.
  • 21. Tower - Mac App - Still beta - Impressive
  • 22. GitX for Mac - GitK for other platforms
  • 23. GitWeb - Web UI - Shipped with Git
  • 25.
  • 26. GitHub is the Facebook of Code GitHub is an unparallel tool I am always struck by the that offers you unlimited wealth of project I find on public repos and private GitHub. repos on subscriptions plans. Lots of major open source projects are there for you to Github is: use and study. 1. Collaboration tool Fork them, change them, 2. Code host contribute in no time. 3. Wiki 4. Issue tracker 5. Code review tool If you are a coder and you 6. Git UI have never used GitHub you 7. Social probably live in a parallel universe :P
  • 27.
  • 28.
  • 29.
  • 31. Questions? You may also use Mercurial, Fossil, Bazaar but Mercurial and Git are the winners :P http://bit.ly/git-dcath