Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Upcoming SlideShare
Go With The Flow With Web 20
Next
Download to read offline and view in fullscreen.

3

Share

Download to read offline

Git, Fast and Distributed Source Code Management

Download to read offline

Git, Fast and Distributed Source Code Management

Related Books

Free with a 30 day trial from Scribd

See all

Git, Fast and Distributed Source Code Management

  1. 1. Git, Fast and Distributed Version Control System Salimane Adjao Moustapha [email_address] http://theindexer.wordpress.com Ethos Technologies
  2. 2. Introduction
  3. 3. Summary <ul><li>What is git? </li></ul><ul><li>Difference git and other SCMs </li></ul><ul><li>Git Object Model </li></ul><ul><li>Why git is better than X </li></ul><ul><li>Benefits of using git for an engineer </li></ul><ul><li>Benefits if using git repos in a company </li></ul><ul><li>Sample git commands </li></ul><ul><li>Conclusion </li></ul>
  4. 4. What is git? <ul><li>Distributed development. </li></ul><ul><li>Strong support for non-linear development. </li></ul><ul><li>Efficient handling of large projects. </li></ul>
  5. 5. Difference git and other SCMs <ul><li>Other SCMs </li></ul><ul><li>- Delta Storage Systems </li></ul><ul><li>- Tracking file permissions and ownership </li></ul><ul><li>Git </li></ul><ul><li>- Snapshot of what all the files in your project look like in this tree structure, each time you commit. Track changes of the tree through time. </li></ul><ul><li>- Tracking the content of the file, not the container </li></ul>
  6. 6. Git Object Model <ul><li>The SHA </li></ul><ul><li>All the information needed to represent the history of a project is stored in files referenced by a 40-digit &quot;object name&quot; that looks something like this: </li></ul><ul><li>6ff87c4664981e4397625791c8ea3bbb5f2279a3 </li></ul><ul><li>This has a number of advantages among others: </li></ul><ul><ul><li>Git can quickly determine whether two objects are identical or not, just by comparing names. </li></ul></ul><ul><ul><li>Since object names are computed the same way in every repository, the same content stored in two repositories will always be stored under the same name. </li></ul></ul><ul><ul><li>Git can detect errors when it reads an object, by checking that the object's name is still the SHA1 hash of its contents. </li></ul></ul>
  7. 7. <ul><li>The Objects </li></ul><ul><li>Every object consists of three things - a type , a size and content . The size is simply the size of the contents, the contents depend on what type of object it is, and there are four different types of objects: </li></ul><ul><ul><li>A &quot;blob&quot; is used to store file data - it is generally a file. </li></ul></ul><ul><ul><li>A &quot;tree&quot; is basically like a directory - it references a bunch of other trees and/or blobs (i.e. files and sub-directories) </li></ul></ul><ul><ul><li>A &quot;commit&quot; points to a single tree, marking it as what the project looked like at a certain point in time. It contains meta-information about that point in time, such as a timestamp, the author of the changes since the last commit, a pointer to the previous commit(s), etc. </li></ul></ul><ul><ul><li>A &quot;tag&quot; is a way to mark a specific commit as special in some way. It is normally used to tag certain commits as specific releases or something along those lines. </li></ul></ul>
  8. 8. Blob Object A blob generally stores the contents of a file. git show 6ff87c466498...
  9. 9. Tree Object A tree is a simple object that has a bunch of pointers to blobs and other trees - it generally represents the contents of a directory or subdirectory. git ls-tree 6ff87c466498...
  10. 10. Commit Object The &quot;commit&quot; object links a physical state of a tree with a description of how we got there and why. git show -s --pretty=raw 6ff87c466498...
  11. 11. . -- README -- lib/ --inc/ --tricks.rb --mylib.rb
  12. 12. Why git is better than X <ul><ul><li>Cheap local branching </li></ul></ul><ul><ul><li>Complex merging </li></ul></ul><ul><ul><li>Everything is Local </li></ul></ul><ul><ul><li>Git is fast </li></ul></ul><ul><ul><li>Git is small </li></ul></ul><ul><ul><li>Easy to learn </li></ul></ul>
  13. 13. Benefits of using git for an engineer <ul><ul><li>You can work offline on your notebook and track every changes you're doing to the codes without anybody noticing anything. </li></ul></ul><ul><ul><li>You can work in parrallel on many tasks. </li></ul></ul><ul><ul><li>You can make mistakes and erase your mistakes. </li></ul></ul><ul><ul><li>You can edit commit and the commit will look like everything was done once. </li></ul></ul><ul><ul><li>You can stash your local modifications and replay them later. </li></ul></ul><ul><ul><li>You can pull from a collegue repo without the server and others being notified </li></ul></ul><ul><ul><li>You become productive because instead wasting time copying, recoding, committing or updating codes, you can concentrate on changing the actual source codes. </li></ul></ul><ul><ul><li>Intuitive commands. </li></ul></ul><ul><ul><li>Creating patches easily (emailing patches easily). </li></ul></ul><ul><ul><li>You can use git with subversion or cvs repositories. </li></ul></ul><ul><ul><li>You don't have to have commit permissions to start making changes and tracking them. (patch, publish). </li></ul></ul><ul><ul><li>One directory .git, no more deeper polluting directories like svn. </li></ul></ul>
  14. 14. Typical workflow
  15. 15. Benefits of using git repos in a company <ul><ul><li>Better impressions on clients / partners </li></ul></ul><ul><ul><li>Easy management of your repositories </li></ul></ul><ul><ul><li>Saving disk space on your servers </li></ul></ul><ul><ul><li>Less load on your servers </li></ul></ul><ul><ul><li>Get more productive time from your engineers </li></ul></ul><ul><ul><li>Saving Money </li></ul></ul>
  16. 16. Sample git commands <ul><ul><li>git init </li></ul></ul><ul><ul><li>git add . </li></ul></ul><ul><ul><li>git commit </li></ul></ul><ul><ul><li>git clone url </li></ul></ul><ul><ul><li>git branch -r </li></ul></ul><ul><ul><li>git stash </li></ul></ul><ul><ul><li>git stash apply </li></ul></ul><ul><ul><li>git checkout -b task1 master </li></ul></ul><ul><ul><li>git commit -a -m “task1 solution” </li></ul></ul><ul><ul><li>git diff --binary HEAD > tempPatch.diff </li></ul></ul><ul><ul><li>git diff task1 HEAD~2 </li></ul></ul><ul><ul><li>git reset –hard </li></ul></ul><ul><ul><li>git status </li></ul></ul><ul><ul><li>git-checkout master </li></ul></ul><ul><ul><li>git merge task1 </li></ul></ul><ul><ul><li>git-branch -d task1 </li></ul></ul><ul><ul><li>git-rebase -i task1 task2 </li></ul></ul><ul><ul><li>git fetch </li></ul></ul><ul><ul><li>git push </li></ul></ul><ul><ul><li>git reset HEAD~3 </li></ul></ul><ul><ul><li>git revert </li></ul></ul>
  17. 17. Projects using git <ul><ul><li>Linux Kernel </li></ul></ul><ul><ul><li>Android </li></ul></ul><ul><ul><li>Fedora </li></ul></ul><ul><ul><li>Perl </li></ul></ul><ul><ul><li>Ruby on Rails </li></ul></ul><ul><ul><li>Gnome </li></ul></ul><ul><ul><li>.... </li></ul></ul>
  18. 18. Tutorial <ul><ul><li>http://www.kernel.org/pub/software/scm/git/docs/gittutorial.html </li></ul></ul><ul><ul><li>http://git-scm.com/course/svn.html </li></ul></ul><ul><ul><li>http://www.spheredev.org/wiki/Git_for_the_lazy </li></ul></ul><ul><ul><li>http://excess.org/article/2008/07/ogre-git-tutorial/ </li></ul></ul><ul><ul><li>http://gitcasts.com/ </li></ul></ul><ul><ul><li>http://book.git-scm.com/5_git_and_email.html </li></ul></ul><ul><ul><li>http://book.git-scm.com/5_customizing_git.html </li></ul></ul>
  • onhafoghefifo

    Jun. 17, 2009
  • catch.why

    Mar. 25, 2009
  • kapil

    Mar. 11, 2009

Git, Fast and Distributed Source Code Management

Views

Total views

2,709

On Slideshare

0

From embeds

0

Number of embeds

290

Actions

Downloads

103

Shares

0

Comments

0

Likes

3

×