Git in Eclipse



Dariusz Łuksza
Blog: http://luksza.org
Mail: dariusz@luksza.org
Agenda
●   What Git is?
    ●   History
    ●   Git vs. CVS/SVN
    ●   How Git works?
●   Git commands
●   What EGit 0.8.1 can do?
●   Demo Time!
    ●   First: project, commit, branch, tag, fetch, push, merge
    ●   Keep high code quality thanks to Git
                                                              2
History of Git'a
2005 - Linus Torvalds starts Git
2006 - Proof-of-concept, quite unusable
2007 - Index reader, quickdiff
2008 - Add history view, commit, push/fetch
2009 - Eclipse decides on Git; moved to Eclipse.org
3/2010 - Released 0.7.0
           Diff/Merge
           Automatic IP Logs
           Preliminary merge algorithm implementation (not really usable for now on)

6/2010 - Released 0.8.0
           Usability Improvements
           Git Repositories View
           Tagging                 Slide taken from presentation:                                 3
                                   Understanding and Using Git at Eclipse | © 2010 by C. Aniszczyk, S.
                                   Pearce, R. Rosenberg and M. Sohn
Git vs. CVS/SVN
●   Distributed (but …)            ●   Centralized
    ●   Ability to work off-line       ●   no
    ●   Full local history             ●   no
●   Versions are described         ●   Numerically described
    using SHA-1                        versions
●   Fast and lightweight           ●   Every branch is a full copy
    branches                           of repository
●   Checkout on repository         ●   Checkout on file/catalog
    level                              level
●   Complex tag's                  ●   Simple tag's
                                                                  4
How Git works?
Saves state not deltas.




                                                         5
         Images taken from Pro Git book (http://progit.org)
How Git works?
    Objects




                                                     6
     Images taken from Pro Git book (http://progit.org)
How Git works?
Branches and tags




   v1.0




                                                          7
          Image taken from Pro Git book (http://progit.org)
How Git works?
Merge (fast-forward)




       fast-forward
          merge




                                                        8
        Images taken from Pro Git book (http://progit.org)
How Git works?
Merge (three-way merge)



      three-way
        merge




                                                            9
            Images taken from Pro Git book (http://progit.org)
How Git works?
              Rebase


1.




     2.




                 3.


                           10
How Git works?
       Structure of .git
extensions
   global exclude file
record branch changes
 object storage
  local branches
    default main branch
   remote tracking branches, divided by repository
   default remote repository
     default remote branch



configuration for this repository

 tip of current branch
cache for staging changes for next commit
                                                     11
Git commands
●   git init / git clone    ●   git pull
●   git add                 ●   git push
●   git status              ●   git stash
●   git commit              ●   git branch
●   git diff                ●   git tag
●   git fetch               ●   git checkout
●   git log                 ●   git config
●   git merge               ●   git format-patch
●   git rebase              ●   git mv / git rm
                                                   12
●   git remote              ●   git reset
Git commands
●   git init / git clone    ●   git pull
●   git add                 ●   git push
●   git status              ●   git stash
●   git commit              ●   git branch
●   git diff                ●   git tag
●   git fetch               ●   git checkout
●   git log                 ●   git config
●   git merge               ●   git format-patch
●   git rebase              ●   git mv / git rm
                                                   13
●   git remote              ●   git reset
What EGit 0.8.1 can do?
●   git init / git clone   ●   git pull
●   git add                ●   git push
●   git status             ●   git stash
●   git commit             ●   git branch
●   git diff               ●   git tag
●   git fetch              ●   git checkout
●   git log                ●   git config
●   git merge              ●   git format-patch
●   git rebase             ●   git mv / git rm
                                                                  14
●   git remote             ●   git reset         Autorem grafik jest:
                                                 Deleket (Jojo Mendoza)
Demo Time!

             15
First demo




Create and share project locally.




                                    16
Second Demo



     Working with remote project.
We'll use gitosis as a Git server and CGit for on-line
                 project presentation.




                                                         17
Third demo



   Benefiting from distributed VCS.

Using Git and Gerrit for keeping project in good
                    shape.



                                                   18
Q&A
●   Git: http://git-scm.com/
●   EGit: http://eclipse.org/egit/
●   JGit: http://eclipse.org/jgit/
●   EGit mailing list:
    http://dev.eclipse.org/mhonarc/lists/egit-dev/
●   JGit mailing list:
    http://dev.eclipse.org/mhonarc/lists/jgit-dev/
●   There is also an EGit forum on Eclipse forums:
    http://www.eclipse.org/forums/
                                                     19

Git in Eclipse

  • 1.
    Git in Eclipse DariuszŁuksza Blog: http://luksza.org Mail: dariusz@luksza.org
  • 2.
    Agenda ● What Git is? ● History ● Git vs. CVS/SVN ● How Git works? ● Git commands ● What EGit 0.8.1 can do? ● Demo Time! ● First: project, commit, branch, tag, fetch, push, merge ● Keep high code quality thanks to Git 2
  • 3.
    History of Git'a 2005- Linus Torvalds starts Git 2006 - Proof-of-concept, quite unusable 2007 - Index reader, quickdiff 2008 - Add history view, commit, push/fetch 2009 - Eclipse decides on Git; moved to Eclipse.org 3/2010 - Released 0.7.0 Diff/Merge Automatic IP Logs Preliminary merge algorithm implementation (not really usable for now on) 6/2010 - Released 0.8.0 Usability Improvements Git Repositories View Tagging Slide taken from presentation: 3 Understanding and Using Git at Eclipse | © 2010 by C. Aniszczyk, S. Pearce, R. Rosenberg and M. Sohn
  • 4.
    Git vs. CVS/SVN ● Distributed (but …) ● Centralized ● Ability to work off-line ● no ● Full local history ● no ● Versions are described ● Numerically described using SHA-1 versions ● Fast and lightweight ● Every branch is a full copy branches of repository ● Checkout on repository ● Checkout on file/catalog level level ● Complex tag's ● Simple tag's 4
  • 5.
    How Git works? Savesstate not deltas. 5 Images taken from Pro Git book (http://progit.org)
  • 6.
    How Git works? Objects 6 Images taken from Pro Git book (http://progit.org)
  • 7.
    How Git works? Branchesand tags v1.0 7 Image taken from Pro Git book (http://progit.org)
  • 8.
    How Git works? Merge(fast-forward) fast-forward merge 8 Images taken from Pro Git book (http://progit.org)
  • 9.
    How Git works? Merge(three-way merge) three-way merge 9 Images taken from Pro Git book (http://progit.org)
  • 10.
    How Git works? Rebase 1. 2. 3. 10
  • 11.
    How Git works? Structure of .git extensions global exclude file record branch changes object storage local branches default main branch remote tracking branches, divided by repository default remote repository default remote branch configuration for this repository tip of current branch cache for staging changes for next commit 11
  • 12.
    Git commands ● git init / git clone ● git pull ● git add ● git push ● git status ● git stash ● git commit ● git branch ● git diff ● git tag ● git fetch ● git checkout ● git log ● git config ● git merge ● git format-patch ● git rebase ● git mv / git rm 12 ● git remote ● git reset
  • 13.
    Git commands ● git init / git clone ● git pull ● git add ● git push ● git status ● git stash ● git commit ● git branch ● git diff ● git tag ● git fetch ● git checkout ● git log ● git config ● git merge ● git format-patch ● git rebase ● git mv / git rm 13 ● git remote ● git reset
  • 14.
    What EGit 0.8.1can do? ● git init / git clone ● git pull ● git add ● git push ● git status ● git stash ● git commit ● git branch ● git diff ● git tag ● git fetch ● git checkout ● git log ● git config ● git merge ● git format-patch ● git rebase ● git mv / git rm 14 ● git remote ● git reset Autorem grafik jest: Deleket (Jojo Mendoza)
  • 15.
  • 16.
    First demo Create andshare project locally. 16
  • 17.
    Second Demo Working with remote project. We'll use gitosis as a Git server and CGit for on-line project presentation. 17
  • 18.
    Third demo Benefiting from distributed VCS. Using Git and Gerrit for keeping project in good shape. 18
  • 19.
    Q&A ● Git: http://git-scm.com/ ● EGit: http://eclipse.org/egit/ ● JGit: http://eclipse.org/jgit/ ● EGit mailing list: http://dev.eclipse.org/mhonarc/lists/egit-dev/ ● JGit mailing list: http://dev.eclipse.org/mhonarc/lists/jgit-dev/ ● There is also an EGit forum on Eclipse forums: http://www.eclipse.org/forums/ 19