Git für Fortgeschrittene



         David Soria Parra I 31. May 2010 | @dsp_




                                                    © 2010 Mayflower GmbH

Montag, 31. Mai 2010
Erwartungen



          I    Man hat Git benutzt
          I    Man kann committen
          I    Branch, Push, Pull, Checkout




                                              Git für Fortgeschrittene I   Mayflower GmbH I May 31, 2010 I

Montag, 31. Mai 2010
Motivation



          I    Viele migrieren: Zend Framework, phpBB, PHPUnit, ...
          I    Größere Projekte haben komplexe Anwendungsfälle
          I    Wir sind am Anfang des Technology Life Cycle




                                                       Git für Fortgeschrittene I   Mayflower GmbH I May 31, 2010 I

Montag, 31. Mai 2010
Beispiel

    developer




                                  Git für Fortgeschrittene I   Mayflower GmbH I May 31, 2010 I

Montag, 31. Mai 2010
Branch und Rebase




              Editieren       Commit                         Veröffentlichen




                                       Git für Fortgeschrittene I   Mayflower GmbH I May 31, 2010 I

Montag, 31. Mai 2010
Feature Branch
                        „Jedes Feature auf eine Branch“




                                                 Git für Fortgeschrittene I   Mayflower GmbH I May 31, 2010 I

Montag, 31. Mai 2010
feature-x



                                                       master
                       DAG (Directed Acyclic Graph)




                                                      Git für Fortgeschrittene I   Mayflower GmbH I May 31, 2010 I

Montag, 31. Mai 2010
master
                                                         feature-y
                       git checkout feature-y   git rebase master


                                                        Git für Fortgeschrittene I   Mayflower GmbH I May 31, 2010 I

Montag, 31. Mai 2010
Branch und Rebase




              Commit          Rebase                                 Merge




                                       Git für Fortgeschrittene I   Mayflower GmbH I May 31, 2010 I

Montag, 31. Mai 2010
Branch und Rebase




                                     bf0255ae




                                                                               feature-y
        git rebase -i bf0225ae   pick / rotate                    squash


                                                 Git für Fortgeschrittene I   Mayflower GmbH I May 31, 2010 I

Montag, 31. Mai 2010
„Never rebase branches that you pulled or
                       pushed. Rebase local branches only!“




                                                   Git für Fortgeschrittene I   Mayflower GmbH I May 31, 2010 I

Montag, 31. Mai 2010
Index




                       Git für Fortgeschrittene I   Mayflower GmbH I May 31, 2010 I

Montag, 31. Mai 2010
$ git status
                       # On branch master
                       # Changed but not updated:
                       # (use "git add <file>..." to update what will be committed)
                       # (use "git checkout -- <file>..." to discard changes in working directory)
                       #
                       #      modified: README.md
                       #
                       no changes added to commit (use "git add" and/or "git commit -a")

                       $ git commit
                       no changes added to commit (use "git add" and/or "git commit -a")




                                                                           Git für Fortgeschrittene I   Mayflower GmbH I May 31, 2010 I

Montag, 31. Mai 2010
working directory            index                      repository


                            git add [file]

                           git stage [file]

                                                     git commit

                                      git commit -a




                                                           Git für Fortgeschrittene I   Mayflower GmbH I May 31, 2010 I

Montag, 31. Mai 2010
static int run_builtin(struct cmd_st
                       +     int status, help;
                            struct stat st;
                            const char *prefix;

                            prefix = NULL;
                            help = argc == 2 && !strcmp(argv[1],
                            if (!help) {
                                  if (p->option & RUN_SETUP)
                                        prefix = setup_git_directory();

                       +          if (use_pager == -1 && p->option
                       +                use_pager = check_pager_c
                       +          if (use_pager == -1 && p->option
                       +
                            }
                                         use_pager = 1;
                                                                                                            Commit
                            commit_pager_choice();




                                                                         git add -i



                                                                                      Git für Fortgeschrittene I   Mayflower GmbH I May 31, 2010 I

Montag, 31. Mai 2010
Neue Konzepte
                       Neue Möglichkeiten



                                      Git für Fortgeschrittene I   Mayflower GmbH I May 31, 2010 I

Montag, 31. Mai 2010
Projekt




                       Git für Fortgeschrittene I   Mayflower GmbH I May 31, 2010 I

Montag, 31. Mai 2010
externe Module




             submodules
                          Git für Fortgeschrittene I   Mayflower GmbH I May 31, 2010 I

Montag, 31. Mai 2010
phpBB


                                                                git.zendframework.com
                       Zend Framework 2




                                           git init phpBB


                       git submodule add git://..../zf2.git Zend Framework 2

                                                                    Git für Fortgeschrittene I   Mayflower GmbH I May 31, 2010 I

Montag, 31. Mai 2010
phpBB


                         Zend Framework 2                        git.zendframework.com


                         Symphony 2                              git.github.com




                       git clone            git submodule init           git submodule update



                                                                    Git für Fortgeschrittene I   Mayflower GmbH I May 31, 2010 I

Montag, 31. Mai 2010
Git ist kein Subversion




                                         Git für Fortgeschrittene I   Mayflower GmbH I May 31, 2010 I

Montag, 31. Mai 2010
system integration




    Administratives
                                     Git für Fortgeschrittene I   Mayflower GmbH I May 31, 2010 I

Montag, 31. Mai 2010
Reflog




                       Git für Fortgeschrittene I   Mayflower GmbH I May 31, 2010 I

Montag, 31. Mai 2010
Reflog



          I    Das Tool zur Recovery


          I WICHTIG!




                                       Git für Fortgeschrittene I   Mayflower GmbH I May 31, 2010 I

Montag, 31. Mai 2010
HEAD@{1}
                git checkout test   git checkout master                git branch -D test



                                                          Git für Fortgeschrittene I   Mayflower GmbH I May 31, 2010 I

Montag, 31. Mai 2010
Git ist manchmal
                       trickreich



                                          Git für Fortgeschrittene I   Mayflower GmbH I May 31, 2010 I

Montag, 31. Mai 2010
Zusammenfassung



          I    DAG und Rebase
          I    Index
          I    Submodule
          I    Reflog




                                Git für Fortgeschrittene I   Mayflower GmbH I May 31, 2010 I

Montag, 31. Mai 2010
Weiterführendes



          I    Konzepten
                I      Storage Format
                I      Refspecs
          I    Cooles Features
                I      Bisect
                I      Notes




                                        Git für Fortgeschrittene I   Mayflower GmbH I May 31, 2010 I

Montag, 31. Mai 2010
Vielen Dank für Ihre Aufmerksamkeit!




                            Fragen?


                                                 © 2010 Mayflower GmbH

Montag, 31. Mai 2010

Git für Fortgeschrittene

  • 1.
    Git für Fortgeschrittene David Soria Parra I 31. May 2010 | @dsp_ © 2010 Mayflower GmbH Montag, 31. Mai 2010
  • 2.
    Erwartungen I Man hat Git benutzt I Man kann committen I Branch, Push, Pull, Checkout Git für Fortgeschrittene I Mayflower GmbH I May 31, 2010 I Montag, 31. Mai 2010
  • 3.
    Motivation I Viele migrieren: Zend Framework, phpBB, PHPUnit, ... I Größere Projekte haben komplexe Anwendungsfälle I Wir sind am Anfang des Technology Life Cycle Git für Fortgeschrittene I Mayflower GmbH I May 31, 2010 I Montag, 31. Mai 2010
  • 4.
    Beispiel developer Git für Fortgeschrittene I Mayflower GmbH I May 31, 2010 I Montag, 31. Mai 2010
  • 5.
    Branch und Rebase Editieren Commit Veröffentlichen Git für Fortgeschrittene I Mayflower GmbH I May 31, 2010 I Montag, 31. Mai 2010
  • 6.
    Feature Branch „Jedes Feature auf eine Branch“ Git für Fortgeschrittene I Mayflower GmbH I May 31, 2010 I Montag, 31. Mai 2010
  • 7.
    feature-x master DAG (Directed Acyclic Graph) Git für Fortgeschrittene I Mayflower GmbH I May 31, 2010 I Montag, 31. Mai 2010
  • 8.
    master feature-y git checkout feature-y git rebase master Git für Fortgeschrittene I Mayflower GmbH I May 31, 2010 I Montag, 31. Mai 2010
  • 9.
    Branch und Rebase Commit Rebase Merge Git für Fortgeschrittene I Mayflower GmbH I May 31, 2010 I Montag, 31. Mai 2010
  • 10.
    Branch und Rebase bf0255ae feature-y git rebase -i bf0225ae pick / rotate squash Git für Fortgeschrittene I Mayflower GmbH I May 31, 2010 I Montag, 31. Mai 2010
  • 11.
    „Never rebase branchesthat you pulled or pushed. Rebase local branches only!“ Git für Fortgeschrittene I Mayflower GmbH I May 31, 2010 I Montag, 31. Mai 2010
  • 12.
    Index Git für Fortgeschrittene I Mayflower GmbH I May 31, 2010 I Montag, 31. Mai 2010
  • 13.
    $ git status # On branch master # Changed but not updated: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: README.md # no changes added to commit (use "git add" and/or "git commit -a") $ git commit no changes added to commit (use "git add" and/or "git commit -a") Git für Fortgeschrittene I Mayflower GmbH I May 31, 2010 I Montag, 31. Mai 2010
  • 14.
    working directory index repository git add [file] git stage [file] git commit git commit -a Git für Fortgeschrittene I Mayflower GmbH I May 31, 2010 I Montag, 31. Mai 2010
  • 15.
    static int run_builtin(structcmd_st + int status, help; struct stat st; const char *prefix; prefix = NULL; help = argc == 2 && !strcmp(argv[1], if (!help) { if (p->option & RUN_SETUP) prefix = setup_git_directory(); + if (use_pager == -1 && p->option + use_pager = check_pager_c + if (use_pager == -1 && p->option + } use_pager = 1; Commit commit_pager_choice(); git add -i Git für Fortgeschrittene I Mayflower GmbH I May 31, 2010 I Montag, 31. Mai 2010
  • 16.
    Neue Konzepte Neue Möglichkeiten Git für Fortgeschrittene I Mayflower GmbH I May 31, 2010 I Montag, 31. Mai 2010
  • 17.
    Projekt Git für Fortgeschrittene I Mayflower GmbH I May 31, 2010 I Montag, 31. Mai 2010
  • 18.
    externe Module submodules Git für Fortgeschrittene I Mayflower GmbH I May 31, 2010 I Montag, 31. Mai 2010
  • 19.
    phpBB git.zendframework.com Zend Framework 2 git init phpBB git submodule add git://..../zf2.git Zend Framework 2 Git für Fortgeschrittene I Mayflower GmbH I May 31, 2010 I Montag, 31. Mai 2010
  • 20.
    phpBB Zend Framework 2 git.zendframework.com Symphony 2 git.github.com git clone git submodule init git submodule update Git für Fortgeschrittene I Mayflower GmbH I May 31, 2010 I Montag, 31. Mai 2010
  • 21.
    Git ist keinSubversion Git für Fortgeschrittene I Mayflower GmbH I May 31, 2010 I Montag, 31. Mai 2010
  • 22.
    system integration Administratives Git für Fortgeschrittene I Mayflower GmbH I May 31, 2010 I Montag, 31. Mai 2010
  • 23.
    Reflog Git für Fortgeschrittene I Mayflower GmbH I May 31, 2010 I Montag, 31. Mai 2010
  • 24.
    Reflog I Das Tool zur Recovery I WICHTIG! Git für Fortgeschrittene I Mayflower GmbH I May 31, 2010 I Montag, 31. Mai 2010
  • 25.
    HEAD@{1} git checkout test git checkout master git branch -D test Git für Fortgeschrittene I Mayflower GmbH I May 31, 2010 I Montag, 31. Mai 2010
  • 26.
    Git ist manchmal trickreich Git für Fortgeschrittene I Mayflower GmbH I May 31, 2010 I Montag, 31. Mai 2010
  • 27.
    Zusammenfassung I DAG und Rebase I Index I Submodule I Reflog Git für Fortgeschrittene I Mayflower GmbH I May 31, 2010 I Montag, 31. Mai 2010
  • 28.
    Weiterführendes I Konzepten I Storage Format I Refspecs I Cooles Features I Bisect I Notes Git für Fortgeschrittene I Mayflower GmbH I May 31, 2010 I Montag, 31. Mai 2010
  • 29.
    Vielen Dank fürIhre Aufmerksamkeit! Fragen? © 2010 Mayflower GmbH Montag, 31. Mai 2010