SlideShare uma empresa Scribd logo
1 de 49
Baixar para ler offline
MONTREAL JUNE 30, JULY 1ST AND 2ND 2012




                       Understanding & Using Git
                       Kieran Kelleher




Monday, July 2, 2012
Objectives
                       • Gain a Better Understanding of Git
                       • Get a Taste of Using Git



Monday, July 2, 2012
Topics
                       • What is Git?
                       • A Bit of Git history
                       • Learn Git Concepts
                        • Git Repository Internals
                       • Environment Setup
                       • Demos : Hands On Git Scenarios

Monday, July 2, 2012
What is Git?
                       •   Distributed Version Control System
                           •   Everyone has (a clone of) the entire repository.
                       •   Free and Open Source
                       •   Is it good?
                       •   “...realize that nothing is perfect. Git is just *closer*
                           to perfect than any other SCM out there.”
                                            - Linus Torvalds, Mar 19, 2007

Monday, July 2, 2012
Why Use Git?

                       sv n




Monday, July 2, 2012
Why Use Git?
                       •   Incredibly flexible branching system
                           •   Cheap and easy local branching
                           •   Non-linear development
                       •   Fast
                       •   Convenient staging area
                       •   Data integrity
                       •   Multiple flexible workflows


Monday, July 2, 2012
A Bit of Git History
               •       Linux Kernel version control

                       •   1991-2002: patch files and tgz’s passed around

                       •   2002-2005: BitKeeper (proprietary DVCS). Free to use for open source projects

               •       In 2005, BitKeeper revoked “free-of-charge” status with the Linux Community

               •       Linus Torvalds and Linux Community developed Git to replace BitKeeper with goals:

                       •   Speed

                       •   Simple Design

                       •   Strong support for non-linear development (thousands of parallel branches)

                       •   Fully distributed

                       •   Able to handle large projects like the Linux kernel efficiently (speed and data size)



Monday, July 2, 2012
Learn Git Concepts




Monday, July 2, 2012
Simple Design

                       “…git actually has a simple design, with stable and
                       reasonably well-documented data structures. In fact,
                       I'm a huge proponent of designing your code around
                       the data, rather than the other way around, and I
                       think it's one of the reasons git has been fairly
                       successful”
                                        Linus Torvalds (2006-06-27)



Monday, July 2, 2012
Most Other VCS - Differences




Monday, July 2, 2012
Git - Snapshots, Not Differences




Monday, July 2, 2012
A Git Project - The Three Areas

                                                              MyProject




                                                                                         .git




                       project working files and directories
                                                                             index

                                                                                                git data store   misc (state/config)
                                                                          staging area




Monday, July 2, 2012
The Core of .git


                                        .git




                       objects   refs          HEAD   index




Monday, July 2, 2012
Git Has Integrity
            •          in•teg•ri•ty |inˈtegritē|

                  •        “the condition of being unified, unimpaired, or sound in construction”

                  •        “internal consistency or lack of corruption in electronic data”

            •          All Objects* are check-summed before storing in Git repository.

                  •        Checksum Mechanism = SHA-1 hash (40 hex chars, 160bits)

                         •     24b9da6552252987aa493b52f8696cd6d3b00373

                  •        Git Knows About All Changes

                  •        Lost or corrupt files will be detected due to SHA-1 hash

                  •        Objective is trust in data/history integrity, not security



                 * commits, files (“blobs”), directories (“trees”), tags

Monday, July 2, 2012
git objects store

                                                                         005ad33f9bebdfa8940ffa8151ad8970158dbf47
         objects
                       ├── 00                                           pack
                       │   ├── 37bb2167adcb7ec49f74c600c25afce639472a
                       │   ├── 5ad33f9bebdfa8940ffa8151ad8970158dbf47
                       │   ├── 75e8abf8860ffe1496b56ef2ea3fb357bde4b9    ├── pack-021a28c9266895014fa9479a89869974ec18d9ee.idx
                       │   ├── 7c921bb962eb4e4c65221e54914641d78768cf    ├── pack-021a28c9266895014fa9479a89869974ec18d9ee.pack
                       │   └── f20eb861e1b8c8efcb76a72ebae41330fabda5    ├── pack-0236a6889657c753316545c8c433985209f583a8.idx
                       ├── 01                                            ├── pack-0236a6889657c753316545c8c433985209f583a8.pack
                       │   ├── 2f7f812bfceea7dbbedca5d3dbc10b9c037a32    ├── pack-19216fc35ba5a25ddd2e89d51bc4e2ce19ef686a.idx
                       │   ├── bb70e63fda542cb85ba6b72ab21ab0ca871aff    ├── pack-19216fc35ba5a25ddd2e89d51bc4e2ce19ef686a.pack
                       │   ├── d888a118f0eac4b9af4408a642776662c57766    ├── pack-866e89cb2093175c08b576159f04c8a484c6ea73.idx
                       │   └── ead33bee50cff13efe1d806dc8c2a70c9d33db    ├── pack-866e89cb2093175c08b576159f04c8a484c6ea73.pack
                       ├── 02                                            ├── pack-890d48f8390c336bd394b098b1b984b297a0a284.idx
                       │   ├── 2558f716b32fabac0dbb94e6f730cc7d642720    ├── pack-890d48f8390c336bd394b098b1b984b297a0a284.pack
                       │   ├── 30293dab83c2d6254062730c95ae4b1fa770a0    ├── pack-93733c14a9d7b9fc927e10a1356613b0a508e619.idx
                       │   ├── 4961b504bdb9fef60571a40c78a591264ef483    ├── pack-93733c14a9d7b9fc927e10a1356613b0a508e619.pack
                       │   ├── b31d0c321bbeedbe369b646764a175561ea31d    ├── pack-b03862852ccafbf5a39563081229dba9802b4bb1.idx
                       │   └── e17256588c1ab894ccf983806c97fb746d1556    ├── pack-b03862852ccafbf5a39563081229dba9802b4bb1.pack
                       ├── 03                                            ├── pack-c2162e2405f78bccec06443c88d24826cada5928.idx
                       │   ├── 3358602202f998530b4cfb142f1430d6855a50    ├── pack-c2162e2405f78bccec06443c88d24826cada5928.pack
                       │   └── 34069b172e52d0de31ebb4defd51c1fce3916c    ├── pack-ded346aeca4d8c714b91c00195d1401f5ba883b7.idx
                       │   ... etc ...                                   └── pack-ded346aeca4d8c714b91c00195d1401f5ba883b7.pack




Monday, July 2, 2012
What is a Git Object?
                                            4 Object Types
   Key:                   3f43ed3                  163c0ad                          3ef2f167                          tq673

                       blob                   tree                             commit                    tag
                                                                                   tree        163c0ad       object       3ef2f167

   Value:                                         blob

                                                  blob
                                                         3f43ed   README.txt

                                                         6a91b4 MyPage.java
                                                                                   parent
                                                                                   author
                                                                                               fe8092
                                                                                               chuck
                                                                                                             type
                                                                                                             tag
                                                                                                                          commit
                                                                                                                          Version 2.02
                                                                                   committer   chuck         tagger       pascal 7/2/2012
                                                  tree   8a5466 MyPage.wo
                                                                                   Fixed bug #123            This release incorporates ERX




                       • file content only     • list of blob and tree          • project root            • Annotated Tag
                       • like a file in            IDs                               snapshot tree ID          Object
                         filesystem            •   like a directory in a        •    parent commit        •    object ID
                                                  filesystem                         ID(s)                      • Any object can
                                                                               •    author                       be tagged
                                                                               •    committer            •    type
                                                                               •    comment              •    author
                                                                                                         •    committer
                                                                                                         •    comment




Monday, July 2, 2012
Exploring Git Objects - commit

   # Check the type of object with sha1 of 3ef2f1678442d8471c3b3d2c138533a6e90aa889
   $ git cat-file -t 3ef2f167
   commit

   # Show content of the object
   $ git cat-file -p 3ef2f167
   tree 163c0addaa4536c77e1b1b32d0b91b9f177e5121
   parent a15326e88ab226cc2a7b29039717534765c43b1a
   author Kieran Kelleher <kelleherk@gmail.com> 1340799645 -0400
   committer Kieran Kelleher <kelleherk@gmail.com> 1340799645 -0400

   Corrects the sentence grammar.




Monday, July 2, 2012
Exploring Git Objects - tree

   # Check the type of object with sha1 of 163c0addaa4536c77e1b1b32d0b91b9f177e5121
   $ git cat-file -t 163c0ad
   tree

   # Show content of the object
   $ git cat-file -p 163c0ad
   100644 blob 331df20e7341fd21cc94392a14099f97e460a10f	 .gitignore
   100644 blob 6a91b495750f8af02c044cbb956a85cbcbcf4235	 .project
   040000 tree 8a54666665989534de1feda6151995744286f135	 .settings
   040000 tree eaf4802023e71ddd5b1ddfedacf789e9386b13ad	 Applications
   100644 blob 998dc0b7e52a4b50e76d1ad33cac8d5033d0bc30	 BUILD.txt
   040000 tree 62552078aa0473231b429b642554b802226a0172	 Build
   040000 tree 66515a47752d78518f616ea8481ec89bb35b8939	 Examples
   040000 tree 02e17256588c1ab894ccf983806c97fb746d1556	 Frameworks
   100644 blob 3f43ed32231713bafb40ad0a510db33de4647a0c	 README.mkd
   040000 tree 8dc972dc8374f55c92a3ed8dc71ef81c455a1d01	 Tests
   040000 tree 88957450c43bc851a16e0f180d621eb4a046667b	 Utilities
   100644 blob 0443ecc59a312e84621610993fe1d9ab09ade3dd	 build.xml
   100644 blob 777c6bb3cb96e68029ff4aa01c4e7d49e476069d	 pom.xml


Monday, July 2, 2012
Exploring Git Objects - blob
   # Check the type of object with sha1 of 3f43ed32231713bafb40ad0a510db33de4647a0c
   $ git cat-file -t 3f43ed3
   blob

   # Show content of the object
   $ git cat-file -p 3f43ed
   About Project Wonder
   --------------------

   Project Wonder is the largest open source collection of reusable WebObjects frameworks, applications
   and
   extensions. Also included in the Wonder collection are deployment software and web server adaptors.

   Project Wonder builds upon, extends and enhances WebObjects, along with automatically patching bugs in
   the core WebObjects frameworks. If you know Java, then Project Wonder is a very powerful and
   productive set of frameworks to build and deploy everything from basic dynamic web applications to
   high traffic, scalable multi-function server applications.

   What Can I Create With Project Wonder?
   ---------------------------------------

   * *Classic Web Applications*. Everything you need to integrate with popular SQL database servers,
   server dynamic web pages, ..........


Monday, July 2, 2012
What’s a commit?
   commit           fe80925
                                                                   commit                       a15326e
   tree            16b917b
   parent          6a08b83                                         tree                     712b1d7
                                                                   parent                   fe80925
   use same logic in Derby plugin ...                              parent                   e1fa64b
                                                                   Merge pull request #223 from...


                       commit             e1fa64b

                      tree               dc00ee1
                                                                    tree                        712b1d7
                      parent             e53ac3e
                                                                  blob          2d2e8b5 README.mkd
                      Loads google maps using the cor...          tree          eaf4802 Applications
                                                                  tree          8dc972d Tests
                                                                  etc .......




                    blob                2d2e8b5                                     tree                  eaf4802        tree                 8dc972d
                                                                                  tree          af504f11 BugTracker    tree          707f02a ERRestTest
                   About Project Wonder
                   --------------------                                           tree          5fb6a21 ERMailer       tree          434b519 ERXTest

                   Project Wonder is the largest                                  tree          02d0592 JavaMonitor    tree          a01a84d JavaNeo4JAda...
                   open source collection......            etc.                   etc .......                          etc .......


                     (README.mkd)                                                        (Applications)                                 (Tests)



                                                                           etc.                                       etc.

Monday, July 2, 2012
What’s a commit?
   commit           fe80925
                                                                   commit                       a15326e                                                         commit                3ef2f167
   tree            16b917b
   parent          6a08b83                                         tree                     712b1d7                                                             tree                 163c0ad
                                                                   parent                   fe80925                                                             parent               a15326e
   use same logic in Derby plugin ...                              parent                   e1fa64b
                                                                   Merge pull request #223 from...                                                              Corrects the sentence grammar.


                       commit             e1fa64b

                      tree               dc00ee1
                                                                                                                                     D ire c te d
                      parent             e53ac3e
                                                                    tree                        712b1d7
                                                                                                                                      A cyc lic                  tree                 163c0ad

                                                                                                                                       G raph
                                                                  blob          2d2e8b5 README.mkd                                                             blob          3f43ed3 README.mkd
                      Loads google maps using the cor...          tree          eaf4802 Applications                                                           tree          eaf4802 Applications

                                                                  tree          8dc972d Tests                                           (DAG)                  tree          8dc972d Tests

                                                                  etc .......                                                                                  etc .......




                    blob                2d2e8b5                                     tree                  eaf4802        tree                 8dc972d            blob                 3f43ed3
                                                                                  tree          af504f11 BugTracker    tree          707f02a ERRestTest
                   About Project Wonder                                                                                                                         About Project Wonder
                   --------------------                                           tree          5fb6a21 ERMailer       tree          434b519 ERXTest            --------------------

                   Project Wonder is the largest                                  tree          02d0592 JavaMonitor    tree          a01a84d JavaNeo4JAda...    Project Wonder is the largest
                   open source collection......            etc.                   etc .......                          etc .......                              open source collection......


                     (README.mkd)                                                        (Applications)                                 (Tests)                         (README.mkd)



                                                                           etc.                                       etc.

Monday, July 2, 2012
Git References (branches, HEAD, etc)
                                                             Commits Over Time




                            master




           commit               fe80925           {PROJECT}/.git/refs/heads/master
           tree
           parent
                                16b917b
                                6a08b83
                                                  fe809251a521c55b7b2c41e024d0bcb71b39e910
           use same logic in Derby plugin ...




            tree                 16b917b
          blob          2d2e8b5 README.mkd
          tree          eaf4802 Applications
          tree          8dc972d Tests
          etc .......




Monday, July 2, 2012
Git References (branches, HEAD, etc)
                                                                Commits Over Time


                             HEAD




                            master                {PROJECT}/.git/HEAD
                                                  ref: refs/heads/master

           commit               fe80925

           tree                 16b917b
           parent               6a08b83


           use same logic in Derby plugin ...




            tree                 16b917b
          blob          2d2e8b5 README.mkd
          tree          eaf4802 Applications
          tree          8dc972d Tests
          etc .......




Monday, July 2, 2012
Git References (branches, HEAD, etc)
                                                             Commits Over Time



                                                                            HEAD




                            master                                       feature/215




           commit               fe80925                     commit                a15326e
           tree                 16b917b                     tree                 712b1d7
           parent               6a08b83                     parent               fe80925

           use same logic in Derby plugin ...               EOModel changes




            tree                 16b917b                     tree                 712b1d7
          blob          2d2e8b5 README.mkd                 blob          2d2e8b5 README.mkd
          tree          eaf4802 Applications               tree          eaf4802 Applications
          tree          8dc972d Tests                      tree          8dc972d Tests
          etc .......                                      etc .......




                                                          edit, edit, edit.... &
                                                $ git commit -am “EOModel Changes”
Monday, July 2, 2012
Git References (branches, HEAD, etc)
                                                           Commits Over Time


                                                                                                                HEAD




                            master                                                                          feature/215




           commit               fe80925                   commit                a15326e        commit                3ef2f167
           tree                 16b917b                   tree                 712b1d7         tree                 163c0ad
           parent               6a08b83                   parent               fe80925         parent               a15326e

           use same logic in Derby plugin ...             EOModel changes                      Corrects the sentence grammar.




            tree                 16b917b                   tree                 712b1d7         tree                 163c0ad
          blob          2d2e8b5 README.mkd               blob          2d2e8b5 README.mkd     blob          3f43ed3 README.mkd
          tree          eaf4802 Applications             tree          eaf4802 Applications   tree          eaf4802 Applications
          tree          8dc972d Tests                    tree          8dc972d Tests          tree          8dc972d Tests
          etc .......                                    etc .......                          etc .......




Monday, July 2, 2012
The Three States
            •          git Directory (repository)

                  •       {PROJECT}/.git/ (directory)

            •          Staging Area (aka the “index”)

                  •       {PROJECT}/.git/index (a binary file)

            •          Working Directory

                  •       {PROJECT}/ (root directory)

                  •       Single checkout of one version of the project

                  •       Editing of files happens here




Monday, July 2, 2012
Installation
    ## Info about ‘git-core’ Using MacPorts
    $ port info git-core
    $ port variants git-core

    ## Install
    $ sudo port install git-core +bash_completion +doc +svn +gitweb

    ## Upgrade
    $ sudo port upgrade git-core

    ## Recommended Add-on
    $ sudo port install git-extras




                                              or

Monday, July 2, 2012
Initial Configuration
                       •   http://git-scm.com/book/en/Getting-Started-First-Time-Git-Setup

                       •   http://git-scm.com/docs/git-config


      # Identity
      $ git config --global user.name "John Doe"
      $ git config --global user.email johndoe@example.com

      # Editor for commit messages, etc.
      $ git config --global core.editor vim



                           section                             key                           value
Monday, July 2, 2012
Git Config Files (man git-config)

              Search
                           Path                            Description
              Order
                       1   .git/config                      Repository

                       2   ~/.gitconfig                     “global” (User)

            # Edit directly in favorite text editor, for example
            $ git config --edit        (or    $ bbedit PROJECT/.git/config )
            $ git config --global edit     (or $ bbedit ~/.gitconfig )

            # Check your config
            $ git config --list


Monday, July 2, 2012
Further Customize ~/.gitconfig (1)
                        http://git-scm.com/book/en/Customizing-Git-Git-Configuration

                       # Color Terminal Output - try it to prevent bleeding eyes
                       [color]
                       	 ui = auto
                       [color "branch"]
                       	 current = yellow reverse
                       	 local = yellow
                        	 remote = green
                       [color "diff"]
                        	 meta = yellow bold
                        	 frag = magenta bold
                        	 old = red
                        	 plain = white
                       	 new = green bold
                       [color "status"]
                        	 added = yellow
                        	 changed = green
                        	 untracked = cyan



Monday, July 2, 2012
Further Customize ~/.gitconfig (2)
                        http://git-scm.com/book/en/Customizing-Git-Git-Configuration

                       # Additional config entries - try it to prevent insanity
                       [core]
                       	 editor = vi
                       	 excludesfile = /Users/<username>/.gitignore
                       	 whitespace = -space-before-tab,-trailing-space
                       [merge]
                       	 tool = opendiff
                       [diff]
                       	 color = auto
                       	 renamelimit = 7000
                       [push]
                          default = simple
                       [alias]
                       	 # log compact
                          lg = log --graph --oneline --all --color --decorate
                          br = branch -avv
Monday, July 2, 2012
Further Customize ~/.gitconfig (3)
                         http://git-scm.com/book/en/Customizing-Git-Git-Configuration

                       # My current aliases
                       br = branch -avv
                       co = checkout
                       cx = cherry-pick -x
                       d = diff
                       dc = diff --cached
                       dh = diff HEAD
                       instaweb = instaweb -d webrick
                       lg = log --graph --oneline --all --color --decorate
                       lga = log --graph --oneline --all --color --decorate --ancestry-path HEAD ^HEAD~20
                       lga100 = log --graph --oneline --all --color --decorate --ancestry-path HEAD ^HEAD~100
                       lga20 = log --graph --oneline --all --color --decorate --ancestry-path HEAD ^HEAD~20
                       lga50 = log --graph --oneline --all --color --decorate --ancestry-path HEAD ^HEAD~50
                       lgd = log --stat --graph --all --color --decorate --source
                       lgfp = log --graph --oneline --all --color --decorate --first-parent
                       lgo = log --oneline --decorate=short
                       lgs = log --stat
                       mf = merge --ff-only
                       st = status
                       uncommit = reset --mixed HEAD~
                       uncommitsoft = reset --soft HEAD~
                       unstage = reset HEAD
                       web = instaweb -d webrick


Monday, July 2, 2012
Command Completion
                       •   Locate the file named ‘git-completion.bash’

                           •   macports: /opt/local/share/doc/git-core/contrib/completion/git-completion.bash

                  ## git   completion
                  source   /opt/local/share/doc/git-core/contrib/completion/git-completion.bash
                  export   GIT_PS1_SHOWDIRTYSTATE="true"
                  export   GIT_PS1_SHOWUNTRACKEDFILES="true"

                  ## Basic git prompt
                  #export PS1='[u@h w$(__git_ps1 " (%s)")]$ '

                  ## Alternative git fancy color prompt
                  function prompt
                  {
                  local WHITE="[033[1;37m]"
                  local GREEN="[033[0;32m]"
                  local CYAN="[033[0;36m]"
                  local GRAY="[033[0;37m]"
                  local BLUE="[033[0;34m]"
                  export PS1="${GRAY}u${CYAN}@${BLUE}h ${CYAN}w"' $(__git_ps1 "(%s)") '"${GREEN}"
                  }
                  prompt




Monday, July 2, 2012
Git Ignore Pattern Files (man gitignore)

            Search
                           Path                 Description
            Order

                       1   */.gitignore         Folder & Child Folders

                       2   .git/info/exclude    repository (local)

                       3   <core.excludes>      User file



Monday, July 2, 2012
Example gitignore File
                  # Typical gitignore for WebObjects Development
                  #
                  .DS_Store
                  bin/
                  .svn/
                  target/
                  dist/
                  build/
                  # Temporary backup files, eg., ~myworkbook.xlsx
                  ~.+




Monday, July 2, 2012
Using Git



Monday, July 2, 2012
Which Tool?
            • Some Free GUI Apps
              • GitX (L) : http://gitx.laullon.com/
              • SourceTree: http://www.sourcetreeapp.com/
            • Commercial Apps
              • Tower : http://www.git-tower.com/




Monday, July 2, 2012
Getting Help
                       •   Terminal

                           •   git help

                           •   git help <verb>

                           •   man git-<verb>

                       •   Browser

                           •   http://git-scm.com/docs

                           •   $ open `git --html-path`/index.html (then bookmark it)

                                   (evidently docs not installed by the dmg installer)

                           •   Git is very well documented, blogged and discussed.

                               •   Google search works well for “git <command>”!



Monday, July 2, 2012
Commonly Used Commands
         add           Add file contents to the index
         branch        List, create, or delete branches
         checkout      Checkout a branch or paths to the working tree
         clone         Clone a repository into a new directory
         commit        Record changes to the repository
         diff          Show changes between commits, commit and working tree, etc
         fetch         Download objects and refs from another repository
         init          Create an empty git repository or reinitialize an existing one
         log           Show commit logs
         merge         Join two or more development histories together
         pull          Fetch from and merge with another repository or a local branch
         push          Update remote refs along with associated objects
         rebase        Forward-port local commits to the updated upstream head
         remote        Manage set of tracked repositories
         reset         Reset current HEAD to the specified state
         clean         Wipe untracked files from Working directory
         show          Show various types of objects
         status        Show the working tree status
         tag           Create, list, delete or verify a tag object signed with GPG




Monday, July 2, 2012
Demo #1
                          “Exploration”

                       gitx     log       show

                       branch   aliases




Monday, July 2, 2012
Demo #2 (+)
                                      “The Failed Push”
                           “github.com”


                       jackgithubwonder.git          JackLocalWonder


                        jillgithubwonder.git         JillLocalWonder




Monday, July 2, 2012
Demo #2
                               “The Failed Push”
                       checkout      reset      commit

                       branch        status     push

                       merge         add (-i)   pull

                       fetch         clean


Monday, July 2, 2012
Demo #3
                       “The Merge Conflict”




Monday, July 2, 2012
Contributing to Wonder+
                       •   Concepts in a Nutshell
                           •   Fork (click a button on github.com)
                           •   Clone *your own* fork of Wonder to your computer
                           •   Start a *feature* branch off of integration
                           •   Push finished feature branch to *your* fork
                           •   Create pull request on github.com



Monday, July 2, 2012
Wonder Contribution Process

                       http://github.com
                                                                            am
                                                                 t e upstre
                                                 (a) git add remo                                     wonder

            projectwonder/wonder.git                                                    origin/integration

                                                                                        origin/master

                                                                                        master
                                                                       ne
                                                                )   clo          (3)    integration
                (1) Fork on github.com                     (2
                                                                                 (4)   myfeature

                                                                                 (5) build and complete your feature code


                                                         (6) push your feature branch to david/wonder.git (origin)
                        david/wonder.git

                                                         (7) make pull request myfeature ==> wonder/integration




Monday, July 2, 2012
Maintaining Your Wonder Fork

                       http://github.com                                         s
                                                                       r branche
                                                        (1) pu ll wonde am
                                                                         e
                                                              fro m upstr                                        wonder

            projectwonder/wonder.git
                                                                                             in)   origin/integration
                                                                                         orig
                                                                                 s (to             origin/master
                                                                             c he
                                                                         r an                      master
                                                                       rb
                                                                    de                             integration
                                                                won
                                                            h
                                                        p us                                       myfeature
                                                    )
                                                  (2




                        david/wonder.git




Monday, July 2, 2012
git push <remote> <src>:<dest>

                                          “git push” default behavior
                        local refs                                                       remote “origin” refs
      * master                 origin/master                                                 master

          integration          origin/integration                                            integration


                             # @see git-config push.default
                             # Git default is “matching”. Will be “simple” in Git 2.0

                             # Only push current branch to remote tracking branch   (YMMV)
                             [push]
                                    default = upstream




      * master                 origin/master                                                 master

          integration          origin/integration                                            integration




Monday, July 2, 2012
More Information
                       •   http://git-scm.com/

                       •   Must See

                           •   http://www.youtube.com/watch?v=4XpnKHJAok8

                           •   http://git-scm.com/2011/07/11/reset.html

                       •   Git Repository Hosting

                           •   github.com (free public hosting)

                           •   bitbucket.org (unlimited private repo hosting 5 users! )

                           •   Install gitolite on your private Linux server!

                               •   http://github.com/sitaramc/gitolite (Recommended!)


Monday, July 2, 2012
Q &A

Monday, July 2, 2012

Mais conteúdo relacionado

Semelhante a Using GIT

Learn Git - For Beginners and Intermediate levels
Learn Git - For Beginners and Intermediate levelsLearn Git - For Beginners and Intermediate levels
Learn Git - For Beginners and Intermediate levelsGorav Singal
 
simple Introduction to git
simple Introduction to gitsimple Introduction to git
simple Introduction to gitOmid Khosrojerdi
 
Git study notes
Git study notesGit study notes
Git study notesAngus Li
 
Git for Android Developers
Git for Android DevelopersGit for Android Developers
Git for Android DevelopersTack Mobile
 
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 .HELLOWorld889594
 
GIT_training_SoftServeBulgaria2016
GIT_training_SoftServeBulgaria2016GIT_training_SoftServeBulgaria2016
GIT_training_SoftServeBulgaria2016Peter Denev
 
Contemporary source control for pharo
Contemporary source control for pharoContemporary source control for pharo
Contemporary source control for pharoESUG
 
git and github-1.pptx
git and github-1.pptxgit and github-1.pptx
git and github-1.pptxtnscharishma
 
January 2022: Central Iowa Linux Users Group: Git
January 2022: Central Iowa Linux Users Group: GitJanuary 2022: Central Iowa Linux Users Group: Git
January 2022: Central Iowa Linux Users Group: GitAndrew Denner
 
Enterprise git
Enterprise gitEnterprise git
Enterprise gitPedro Melo
 
Manage Org Changes Using the Force.com Migration Tool and Git
Manage Org Changes Using the Force.com Migration Tool and GitManage Org Changes Using the Force.com Migration Tool and Git
Manage Org Changes Using the Force.com Migration Tool and GitSalesforce Developers
 

Semelhante a Using GIT (20)

Git workshop
Git workshopGit workshop
Git workshop
 
Learn Git - For Beginners and Intermediate levels
Learn Git - For Beginners and Intermediate levelsLearn Git - For Beginners and Intermediate levels
Learn Git - For Beginners and Intermediate levels
 
simple Introduction to git
simple Introduction to gitsimple Introduction to git
simple Introduction to git
 
Git study notes
Git study notesGit study notes
Git study notes
 
Git for Android Developers
Git for Android DevelopersGit for Android Developers
Git for Android Developers
 
Mini git tutorial
Mini git tutorialMini git tutorial
Mini git tutorial
 
Demo
DemoDemo
Demo
 
GIT-FirstPart.ppt
GIT-FirstPart.pptGIT-FirstPart.ppt
GIT-FirstPart.ppt
 
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 in Eclipse
Git in EclipseGit in Eclipse
Git in Eclipse
 
GIT_training_SoftServeBulgaria2016
GIT_training_SoftServeBulgaria2016GIT_training_SoftServeBulgaria2016
GIT_training_SoftServeBulgaria2016
 
Contemporary source control for pharo
Contemporary source control for pharoContemporary source control for pharo
Contemporary source control for pharo
 
git and github-1.pptx
git and github-1.pptxgit and github-1.pptx
git and github-1.pptx
 
Dcvs
DcvsDcvs
Dcvs
 
git presentation
git presentation git presentation
git presentation
 
Git Real
Git RealGit Real
Git Real
 
January 2022: Central Iowa Linux Users Group: Git
January 2022: Central Iowa Linux Users Group: GitJanuary 2022: Central Iowa Linux Users Group: Git
January 2022: Central Iowa Linux Users Group: Git
 
Introduction to Git (part 1)
Introduction to Git (part 1)Introduction to Git (part 1)
Introduction to Git (part 1)
 
Enterprise git
Enterprise gitEnterprise git
Enterprise git
 
Manage Org Changes Using the Force.com Migration Tool and Git
Manage Org Changes Using the Force.com Migration Tool and GitManage Org Changes Using the Force.com Migration Tool and Git
Manage Org Changes Using the Force.com Migration Tool and Git
 

Mais de WO Community

In memory OLAP engine
In memory OLAP engineIn memory OLAP engine
In memory OLAP engineWO Community
 
Using Nagios to monitor your WO systems
Using Nagios to monitor your WO systemsUsing Nagios to monitor your WO systems
Using Nagios to monitor your WO systemsWO Community
 
Build and deployment
Build and deploymentBuild and deployment
Build and deploymentWO Community
 
Reenabling SOAP using ERJaxWS
Reenabling SOAP using ERJaxWSReenabling SOAP using ERJaxWS
Reenabling SOAP using ERJaxWSWO Community
 
Chaining the Beast - Testing Wonder Applications in the Real World
Chaining the Beast - Testing Wonder Applications in the Real WorldChaining the Beast - Testing Wonder Applications in the Real World
Chaining the Beast - Testing Wonder Applications in the Real WorldWO Community
 
D2W Stateful Controllers
D2W Stateful ControllersD2W Stateful Controllers
D2W Stateful ControllersWO Community
 
Deploying WO on Windows
Deploying WO on WindowsDeploying WO on Windows
Deploying WO on WindowsWO Community
 
Unit Testing with WOUnit
Unit Testing with WOUnitUnit Testing with WOUnit
Unit Testing with WOUnitWO Community
 
Apache Cayenne for WO Devs
Apache Cayenne for WO DevsApache Cayenne for WO Devs
Apache Cayenne for WO DevsWO Community
 
Advanced Apache Cayenne
Advanced Apache CayenneAdvanced Apache Cayenne
Advanced Apache CayenneWO Community
 
Migrating existing Projects to Wonder
Migrating existing Projects to WonderMigrating existing Projects to Wonder
Migrating existing Projects to WonderWO Community
 
iOS for ERREST - alternative version
iOS for ERREST - alternative versioniOS for ERREST - alternative version
iOS for ERREST - alternative versionWO Community
 
"Framework Principal" pattern
"Framework Principal" pattern"Framework Principal" pattern
"Framework Principal" patternWO Community
 
Filtering data with D2W
Filtering data with D2W Filtering data with D2W
Filtering data with D2W WO Community
 
Localizing your apps for multibyte languages
Localizing your apps for multibyte languagesLocalizing your apps for multibyte languages
Localizing your apps for multibyte languagesWO Community
 

Mais de WO Community (20)

In memory OLAP engine
In memory OLAP engineIn memory OLAP engine
In memory OLAP engine
 
Using Nagios to monitor your WO systems
Using Nagios to monitor your WO systemsUsing Nagios to monitor your WO systems
Using Nagios to monitor your WO systems
 
Build and deployment
Build and deploymentBuild and deployment
Build and deployment
 
Reenabling SOAP using ERJaxWS
Reenabling SOAP using ERJaxWSReenabling SOAP using ERJaxWS
Reenabling SOAP using ERJaxWS
 
Chaining the Beast - Testing Wonder Applications in the Real World
Chaining the Beast - Testing Wonder Applications in the Real WorldChaining the Beast - Testing Wonder Applications in the Real World
Chaining the Beast - Testing Wonder Applications in the Real World
 
D2W Stateful Controllers
D2W Stateful ControllersD2W Stateful Controllers
D2W Stateful Controllers
 
Deploying WO on Windows
Deploying WO on WindowsDeploying WO on Windows
Deploying WO on Windows
 
Unit Testing with WOUnit
Unit Testing with WOUnitUnit Testing with WOUnit
Unit Testing with WOUnit
 
Life outside WO
Life outside WOLife outside WO
Life outside WO
 
Apache Cayenne for WO Devs
Apache Cayenne for WO DevsApache Cayenne for WO Devs
Apache Cayenne for WO Devs
 
Advanced Apache Cayenne
Advanced Apache CayenneAdvanced Apache Cayenne
Advanced Apache Cayenne
 
Migrating existing Projects to Wonder
Migrating existing Projects to WonderMigrating existing Projects to Wonder
Migrating existing Projects to Wonder
 
iOS for ERREST - alternative version
iOS for ERREST - alternative versioniOS for ERREST - alternative version
iOS for ERREST - alternative version
 
iOS for ERREST
iOS for ERRESTiOS for ERREST
iOS for ERREST
 
"Framework Principal" pattern
"Framework Principal" pattern"Framework Principal" pattern
"Framework Principal" pattern
 
Filtering data with D2W
Filtering data with D2W Filtering data with D2W
Filtering data with D2W
 
WOver
WOverWOver
WOver
 
Localizing your apps for multibyte languages
Localizing your apps for multibyte languagesLocalizing your apps for multibyte languages
Localizing your apps for multibyte languages
 
WOdka
WOdkaWOdka
WOdka
 
ERGroupware
ERGroupwareERGroupware
ERGroupware
 

Último

Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 

Último (20)

Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 

Using GIT

  • 1. MONTREAL JUNE 30, JULY 1ST AND 2ND 2012 Understanding & Using Git Kieran Kelleher Monday, July 2, 2012
  • 2. Objectives • Gain a Better Understanding of Git • Get a Taste of Using Git Monday, July 2, 2012
  • 3. Topics • What is Git? • A Bit of Git history • Learn Git Concepts • Git Repository Internals • Environment Setup • Demos : Hands On Git Scenarios Monday, July 2, 2012
  • 4. What is Git? • Distributed Version Control System • Everyone has (a clone of) the entire repository. • Free and Open Source • Is it good? • “...realize that nothing is perfect. Git is just *closer* to perfect than any other SCM out there.” - Linus Torvalds, Mar 19, 2007 Monday, July 2, 2012
  • 5. Why Use Git? sv n Monday, July 2, 2012
  • 6. Why Use Git? • Incredibly flexible branching system • Cheap and easy local branching • Non-linear development • Fast • Convenient staging area • Data integrity • Multiple flexible workflows Monday, July 2, 2012
  • 7. A Bit of Git History • Linux Kernel version control • 1991-2002: patch files and tgz’s passed around • 2002-2005: BitKeeper (proprietary DVCS). Free to use for open source projects • In 2005, BitKeeper revoked “free-of-charge” status with the Linux Community • Linus Torvalds and Linux Community developed Git to replace BitKeeper with goals: • Speed • Simple Design • Strong support for non-linear development (thousands of parallel branches) • Fully distributed • Able to handle large projects like the Linux kernel efficiently (speed and data size) Monday, July 2, 2012
  • 9. Simple Design “…git actually has a simple design, with stable and reasonably well-documented data structures. In fact, I'm a huge proponent of designing your code around the data, rather than the other way around, and I think it's one of the reasons git has been fairly successful” Linus Torvalds (2006-06-27) Monday, July 2, 2012
  • 10. Most Other VCS - Differences Monday, July 2, 2012
  • 11. Git - Snapshots, Not Differences Monday, July 2, 2012
  • 12. A Git Project - The Three Areas MyProject .git project working files and directories index git data store misc (state/config) staging area Monday, July 2, 2012
  • 13. The Core of .git .git objects refs HEAD index Monday, July 2, 2012
  • 14. Git Has Integrity • in•teg•ri•ty |inˈtegritē| • “the condition of being unified, unimpaired, or sound in construction” • “internal consistency or lack of corruption in electronic data” • All Objects* are check-summed before storing in Git repository. • Checksum Mechanism = SHA-1 hash (40 hex chars, 160bits) • 24b9da6552252987aa493b52f8696cd6d3b00373 • Git Knows About All Changes • Lost or corrupt files will be detected due to SHA-1 hash • Objective is trust in data/history integrity, not security * commits, files (“blobs”), directories (“trees”), tags Monday, July 2, 2012
  • 15. git objects store 005ad33f9bebdfa8940ffa8151ad8970158dbf47 objects ├── 00 pack │   ├── 37bb2167adcb7ec49f74c600c25afce639472a │   ├── 5ad33f9bebdfa8940ffa8151ad8970158dbf47 │   ├── 75e8abf8860ffe1496b56ef2ea3fb357bde4b9 ├── pack-021a28c9266895014fa9479a89869974ec18d9ee.idx │   ├── 7c921bb962eb4e4c65221e54914641d78768cf ├── pack-021a28c9266895014fa9479a89869974ec18d9ee.pack │   └── f20eb861e1b8c8efcb76a72ebae41330fabda5 ├── pack-0236a6889657c753316545c8c433985209f583a8.idx ├── 01 ├── pack-0236a6889657c753316545c8c433985209f583a8.pack │   ├── 2f7f812bfceea7dbbedca5d3dbc10b9c037a32 ├── pack-19216fc35ba5a25ddd2e89d51bc4e2ce19ef686a.idx │   ├── bb70e63fda542cb85ba6b72ab21ab0ca871aff ├── pack-19216fc35ba5a25ddd2e89d51bc4e2ce19ef686a.pack │   ├── d888a118f0eac4b9af4408a642776662c57766 ├── pack-866e89cb2093175c08b576159f04c8a484c6ea73.idx │   └── ead33bee50cff13efe1d806dc8c2a70c9d33db ├── pack-866e89cb2093175c08b576159f04c8a484c6ea73.pack ├── 02 ├── pack-890d48f8390c336bd394b098b1b984b297a0a284.idx │   ├── 2558f716b32fabac0dbb94e6f730cc7d642720 ├── pack-890d48f8390c336bd394b098b1b984b297a0a284.pack │   ├── 30293dab83c2d6254062730c95ae4b1fa770a0 ├── pack-93733c14a9d7b9fc927e10a1356613b0a508e619.idx │   ├── 4961b504bdb9fef60571a40c78a591264ef483 ├── pack-93733c14a9d7b9fc927e10a1356613b0a508e619.pack │   ├── b31d0c321bbeedbe369b646764a175561ea31d ├── pack-b03862852ccafbf5a39563081229dba9802b4bb1.idx │   └── e17256588c1ab894ccf983806c97fb746d1556 ├── pack-b03862852ccafbf5a39563081229dba9802b4bb1.pack ├── 03 ├── pack-c2162e2405f78bccec06443c88d24826cada5928.idx │   ├── 3358602202f998530b4cfb142f1430d6855a50 ├── pack-c2162e2405f78bccec06443c88d24826cada5928.pack │   └── 34069b172e52d0de31ebb4defd51c1fce3916c ├── pack-ded346aeca4d8c714b91c00195d1401f5ba883b7.idx │   ... etc ... └── pack-ded346aeca4d8c714b91c00195d1401f5ba883b7.pack Monday, July 2, 2012
  • 16. What is a Git Object? 4 Object Types Key: 3f43ed3 163c0ad 3ef2f167 tq673 blob tree commit tag tree 163c0ad object 3ef2f167 Value: blob blob 3f43ed README.txt 6a91b4 MyPage.java parent author fe8092 chuck type tag commit Version 2.02 committer chuck tagger pascal 7/2/2012 tree 8a5466 MyPage.wo Fixed bug #123 This release incorporates ERX • file content only • list of blob and tree • project root • Annotated Tag • like a file in IDs snapshot tree ID Object filesystem • like a directory in a • parent commit • object ID filesystem ID(s) • Any object can • author be tagged • committer • type • comment • author • committer • comment Monday, July 2, 2012
  • 17. Exploring Git Objects - commit # Check the type of object with sha1 of 3ef2f1678442d8471c3b3d2c138533a6e90aa889 $ git cat-file -t 3ef2f167 commit # Show content of the object $ git cat-file -p 3ef2f167 tree 163c0addaa4536c77e1b1b32d0b91b9f177e5121 parent a15326e88ab226cc2a7b29039717534765c43b1a author Kieran Kelleher <kelleherk@gmail.com> 1340799645 -0400 committer Kieran Kelleher <kelleherk@gmail.com> 1340799645 -0400 Corrects the sentence grammar. Monday, July 2, 2012
  • 18. Exploring Git Objects - tree # Check the type of object with sha1 of 163c0addaa4536c77e1b1b32d0b91b9f177e5121 $ git cat-file -t 163c0ad tree # Show content of the object $ git cat-file -p 163c0ad 100644 blob 331df20e7341fd21cc94392a14099f97e460a10f .gitignore 100644 blob 6a91b495750f8af02c044cbb956a85cbcbcf4235 .project 040000 tree 8a54666665989534de1feda6151995744286f135 .settings 040000 tree eaf4802023e71ddd5b1ddfedacf789e9386b13ad Applications 100644 blob 998dc0b7e52a4b50e76d1ad33cac8d5033d0bc30 BUILD.txt 040000 tree 62552078aa0473231b429b642554b802226a0172 Build 040000 tree 66515a47752d78518f616ea8481ec89bb35b8939 Examples 040000 tree 02e17256588c1ab894ccf983806c97fb746d1556 Frameworks 100644 blob 3f43ed32231713bafb40ad0a510db33de4647a0c README.mkd 040000 tree 8dc972dc8374f55c92a3ed8dc71ef81c455a1d01 Tests 040000 tree 88957450c43bc851a16e0f180d621eb4a046667b Utilities 100644 blob 0443ecc59a312e84621610993fe1d9ab09ade3dd build.xml 100644 blob 777c6bb3cb96e68029ff4aa01c4e7d49e476069d pom.xml Monday, July 2, 2012
  • 19. Exploring Git Objects - blob # Check the type of object with sha1 of 3f43ed32231713bafb40ad0a510db33de4647a0c $ git cat-file -t 3f43ed3 blob # Show content of the object $ git cat-file -p 3f43ed About Project Wonder -------------------- Project Wonder is the largest open source collection of reusable WebObjects frameworks, applications and extensions. Also included in the Wonder collection are deployment software and web server adaptors. Project Wonder builds upon, extends and enhances WebObjects, along with automatically patching bugs in the core WebObjects frameworks. If you know Java, then Project Wonder is a very powerful and productive set of frameworks to build and deploy everything from basic dynamic web applications to high traffic, scalable multi-function server applications. What Can I Create With Project Wonder? --------------------------------------- * *Classic Web Applications*. Everything you need to integrate with popular SQL database servers, server dynamic web pages, .......... Monday, July 2, 2012
  • 20. What’s a commit? commit fe80925 commit a15326e tree 16b917b parent 6a08b83 tree 712b1d7 parent fe80925 use same logic in Derby plugin ... parent e1fa64b Merge pull request #223 from... commit e1fa64b tree dc00ee1 tree 712b1d7 parent e53ac3e blob 2d2e8b5 README.mkd Loads google maps using the cor... tree eaf4802 Applications tree 8dc972d Tests etc ....... blob 2d2e8b5 tree eaf4802 tree 8dc972d tree af504f11 BugTracker tree 707f02a ERRestTest About Project Wonder -------------------- tree 5fb6a21 ERMailer tree 434b519 ERXTest Project Wonder is the largest tree 02d0592 JavaMonitor tree a01a84d JavaNeo4JAda... open source collection...... etc. etc ....... etc ....... (README.mkd) (Applications) (Tests) etc. etc. Monday, July 2, 2012
  • 21. What’s a commit? commit fe80925 commit a15326e commit 3ef2f167 tree 16b917b parent 6a08b83 tree 712b1d7 tree 163c0ad parent fe80925 parent a15326e use same logic in Derby plugin ... parent e1fa64b Merge pull request #223 from... Corrects the sentence grammar. commit e1fa64b tree dc00ee1 D ire c te d parent e53ac3e tree 712b1d7 A cyc lic tree 163c0ad G raph blob 2d2e8b5 README.mkd blob 3f43ed3 README.mkd Loads google maps using the cor... tree eaf4802 Applications tree eaf4802 Applications tree 8dc972d Tests (DAG) tree 8dc972d Tests etc ....... etc ....... blob 2d2e8b5 tree eaf4802 tree 8dc972d blob 3f43ed3 tree af504f11 BugTracker tree 707f02a ERRestTest About Project Wonder About Project Wonder -------------------- tree 5fb6a21 ERMailer tree 434b519 ERXTest -------------------- Project Wonder is the largest tree 02d0592 JavaMonitor tree a01a84d JavaNeo4JAda... Project Wonder is the largest open source collection...... etc. etc ....... etc ....... open source collection...... (README.mkd) (Applications) (Tests) (README.mkd) etc. etc. Monday, July 2, 2012
  • 22. Git References (branches, HEAD, etc) Commits Over Time master commit fe80925 {PROJECT}/.git/refs/heads/master tree parent 16b917b 6a08b83 fe809251a521c55b7b2c41e024d0bcb71b39e910 use same logic in Derby plugin ... tree 16b917b blob 2d2e8b5 README.mkd tree eaf4802 Applications tree 8dc972d Tests etc ....... Monday, July 2, 2012
  • 23. Git References (branches, HEAD, etc) Commits Over Time HEAD master {PROJECT}/.git/HEAD ref: refs/heads/master commit fe80925 tree 16b917b parent 6a08b83 use same logic in Derby plugin ... tree 16b917b blob 2d2e8b5 README.mkd tree eaf4802 Applications tree 8dc972d Tests etc ....... Monday, July 2, 2012
  • 24. Git References (branches, HEAD, etc) Commits Over Time HEAD master feature/215 commit fe80925 commit a15326e tree 16b917b tree 712b1d7 parent 6a08b83 parent fe80925 use same logic in Derby plugin ... EOModel changes tree 16b917b tree 712b1d7 blob 2d2e8b5 README.mkd blob 2d2e8b5 README.mkd tree eaf4802 Applications tree eaf4802 Applications tree 8dc972d Tests tree 8dc972d Tests etc ....... etc ....... edit, edit, edit.... & $ git commit -am “EOModel Changes” Monday, July 2, 2012
  • 25. Git References (branches, HEAD, etc) Commits Over Time HEAD master feature/215 commit fe80925 commit a15326e commit 3ef2f167 tree 16b917b tree 712b1d7 tree 163c0ad parent 6a08b83 parent fe80925 parent a15326e use same logic in Derby plugin ... EOModel changes Corrects the sentence grammar. tree 16b917b tree 712b1d7 tree 163c0ad blob 2d2e8b5 README.mkd blob 2d2e8b5 README.mkd blob 3f43ed3 README.mkd tree eaf4802 Applications tree eaf4802 Applications tree eaf4802 Applications tree 8dc972d Tests tree 8dc972d Tests tree 8dc972d Tests etc ....... etc ....... etc ....... Monday, July 2, 2012
  • 26. The Three States • git Directory (repository) • {PROJECT}/.git/ (directory) • Staging Area (aka the “index”) • {PROJECT}/.git/index (a binary file) • Working Directory • {PROJECT}/ (root directory) • Single checkout of one version of the project • Editing of files happens here Monday, July 2, 2012
  • 27. Installation ## Info about ‘git-core’ Using MacPorts $ port info git-core $ port variants git-core ## Install $ sudo port install git-core +bash_completion +doc +svn +gitweb ## Upgrade $ sudo port upgrade git-core ## Recommended Add-on $ sudo port install git-extras or Monday, July 2, 2012
  • 28. Initial Configuration • http://git-scm.com/book/en/Getting-Started-First-Time-Git-Setup • http://git-scm.com/docs/git-config # Identity $ git config --global user.name "John Doe" $ git config --global user.email johndoe@example.com # Editor for commit messages, etc. $ git config --global core.editor vim section key value Monday, July 2, 2012
  • 29. Git Config Files (man git-config) Search Path Description Order 1 .git/config Repository 2 ~/.gitconfig “global” (User) # Edit directly in favorite text editor, for example $ git config --edit (or $ bbedit PROJECT/.git/config ) $ git config --global edit (or $ bbedit ~/.gitconfig ) # Check your config $ git config --list Monday, July 2, 2012
  • 30. Further Customize ~/.gitconfig (1) http://git-scm.com/book/en/Customizing-Git-Git-Configuration # Color Terminal Output - try it to prevent bleeding eyes [color] ui = auto [color "branch"] current = yellow reverse local = yellow remote = green [color "diff"] meta = yellow bold frag = magenta bold old = red plain = white new = green bold [color "status"] added = yellow changed = green untracked = cyan Monday, July 2, 2012
  • 31. Further Customize ~/.gitconfig (2) http://git-scm.com/book/en/Customizing-Git-Git-Configuration # Additional config entries - try it to prevent insanity [core] editor = vi excludesfile = /Users/<username>/.gitignore whitespace = -space-before-tab,-trailing-space [merge] tool = opendiff [diff] color = auto renamelimit = 7000 [push] default = simple [alias] # log compact lg = log --graph --oneline --all --color --decorate br = branch -avv Monday, July 2, 2012
  • 32. Further Customize ~/.gitconfig (3) http://git-scm.com/book/en/Customizing-Git-Git-Configuration # My current aliases br = branch -avv co = checkout cx = cherry-pick -x d = diff dc = diff --cached dh = diff HEAD instaweb = instaweb -d webrick lg = log --graph --oneline --all --color --decorate lga = log --graph --oneline --all --color --decorate --ancestry-path HEAD ^HEAD~20 lga100 = log --graph --oneline --all --color --decorate --ancestry-path HEAD ^HEAD~100 lga20 = log --graph --oneline --all --color --decorate --ancestry-path HEAD ^HEAD~20 lga50 = log --graph --oneline --all --color --decorate --ancestry-path HEAD ^HEAD~50 lgd = log --stat --graph --all --color --decorate --source lgfp = log --graph --oneline --all --color --decorate --first-parent lgo = log --oneline --decorate=short lgs = log --stat mf = merge --ff-only st = status uncommit = reset --mixed HEAD~ uncommitsoft = reset --soft HEAD~ unstage = reset HEAD web = instaweb -d webrick Monday, July 2, 2012
  • 33. Command Completion • Locate the file named ‘git-completion.bash’ • macports: /opt/local/share/doc/git-core/contrib/completion/git-completion.bash ## git completion source /opt/local/share/doc/git-core/contrib/completion/git-completion.bash export GIT_PS1_SHOWDIRTYSTATE="true" export GIT_PS1_SHOWUNTRACKEDFILES="true" ## Basic git prompt #export PS1='[u@h w$(__git_ps1 " (%s)")]$ ' ## Alternative git fancy color prompt function prompt { local WHITE="[033[1;37m]" local GREEN="[033[0;32m]" local CYAN="[033[0;36m]" local GRAY="[033[0;37m]" local BLUE="[033[0;34m]" export PS1="${GRAY}u${CYAN}@${BLUE}h ${CYAN}w"' $(__git_ps1 "(%s)") '"${GREEN}" } prompt Monday, July 2, 2012
  • 34. Git Ignore Pattern Files (man gitignore) Search Path Description Order 1 */.gitignore Folder & Child Folders 2 .git/info/exclude repository (local) 3 <core.excludes> User file Monday, July 2, 2012
  • 35. Example gitignore File # Typical gitignore for WebObjects Development # .DS_Store bin/ .svn/ target/ dist/ build/ # Temporary backup files, eg., ~myworkbook.xlsx ~.+ Monday, July 2, 2012
  • 37. Which Tool? • Some Free GUI Apps • GitX (L) : http://gitx.laullon.com/ • SourceTree: http://www.sourcetreeapp.com/ • Commercial Apps • Tower : http://www.git-tower.com/ Monday, July 2, 2012
  • 38. Getting Help • Terminal • git help • git help <verb> • man git-<verb> • Browser • http://git-scm.com/docs • $ open `git --html-path`/index.html (then bookmark it) (evidently docs not installed by the dmg installer) • Git is very well documented, blogged and discussed. • Google search works well for “git <command>”! Monday, July 2, 2012
  • 39. Commonly Used Commands add Add file contents to the index branch List, create, or delete branches checkout Checkout a branch or paths to the working tree clone Clone a repository into a new directory commit Record changes to the repository diff Show changes between commits, commit and working tree, etc fetch Download objects and refs from another repository init Create an empty git repository or reinitialize an existing one log Show commit logs merge Join two or more development histories together pull Fetch from and merge with another repository or a local branch push Update remote refs along with associated objects rebase Forward-port local commits to the updated upstream head remote Manage set of tracked repositories reset Reset current HEAD to the specified state clean Wipe untracked files from Working directory show Show various types of objects status Show the working tree status tag Create, list, delete or verify a tag object signed with GPG Monday, July 2, 2012
  • 40. Demo #1 “Exploration” gitx log show branch aliases Monday, July 2, 2012
  • 41. Demo #2 (+) “The Failed Push” “github.com” jackgithubwonder.git JackLocalWonder jillgithubwonder.git JillLocalWonder Monday, July 2, 2012
  • 42. Demo #2 “The Failed Push” checkout reset commit branch status push merge add (-i) pull fetch clean Monday, July 2, 2012
  • 43. Demo #3 “The Merge Conflict” Monday, July 2, 2012
  • 44. Contributing to Wonder+ • Concepts in a Nutshell • Fork (click a button on github.com) • Clone *your own* fork of Wonder to your computer • Start a *feature* branch off of integration • Push finished feature branch to *your* fork • Create pull request on github.com Monday, July 2, 2012
  • 45. Wonder Contribution Process http://github.com am t e upstre (a) git add remo wonder projectwonder/wonder.git origin/integration origin/master master ne ) clo (3) integration (1) Fork on github.com (2 (4) myfeature (5) build and complete your feature code (6) push your feature branch to david/wonder.git (origin) david/wonder.git (7) make pull request myfeature ==> wonder/integration Monday, July 2, 2012
  • 46. Maintaining Your Wonder Fork http://github.com s r branche (1) pu ll wonde am e fro m upstr wonder projectwonder/wonder.git in) origin/integration orig s (to origin/master c he r an master rb de integration won h p us myfeature ) (2 david/wonder.git Monday, July 2, 2012
  • 47. git push <remote> <src>:<dest> “git push” default behavior local refs remote “origin” refs * master origin/master master integration origin/integration integration # @see git-config push.default # Git default is “matching”. Will be “simple” in Git 2.0 # Only push current branch to remote tracking branch (YMMV) [push] default = upstream * master origin/master master integration origin/integration integration Monday, July 2, 2012
  • 48. More Information • http://git-scm.com/ • Must See • http://www.youtube.com/watch?v=4XpnKHJAok8 • http://git-scm.com/2011/07/11/reset.html • Git Repository Hosting • github.com (free public hosting) • bitbucket.org (unlimited private repo hosting 5 users! ) • Install gitolite on your private Linux server! • http://github.com/sitaramc/gitolite (Recommended!) Monday, July 2, 2012
  • 49. Q &A Monday, July 2, 2012