Git presentation


Published on

Introduction to Git

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Git presentation

  1. 1. Agenda ● Git introduction ● Why Git? ● Git VS Subversion ● Basic Commands ● Branching & Merging ● Typical Workflow
  2. 2. Git introduction ● Distributed Version Control System ● Speed & Efficiency ● Decentralized
  3. 3. Why Git? ● Distributed ● Non-linear ● Scale
  4. 4. Why Git? Distributed – Local repo – With entire dev history – Off-line work – Remote sync
  5. 5. Why Git? Non-linear – Rapid branching and merging – merging more often than writing – passing around various reviewers
  6. 6. Why Git? Scale – Efficient handling of large projects – Fast – scalable
  7. 7. Git VS Subversion Git is not better than Subversion. But is also not worse. It's different. The key difference is that it is decentralized. Imagine you are a developer on the road, you develop on your laptop and you want to have source control so that you can go back 3 hours. With Subversion, you have a Problem: The SVN Repository may be in a location you can't reach (in your company, and you don't have Internet at the moment), you cannot commit. If you want to make a copy of your code, you have to literally copy/paste it. With Git, you do not have this problem. Your local copy is a repository, and you can commit to it and get all benefits of source control. When you regain connectivity to the main repository, you can commit against it. SVN: has the advantage that it's MUCH simpler to learn: There is your repository, all changes to towards it, if you know how to create, commit and checkout and you're ready to go and can pickup stuff like branching, update etc. later on. Git: has the advantage that it's MUCH better suited if some developers are not always connected to the master repository. Also, it's much faster than SVN. And from what I hear, branching and merging support is a lot better (which is to be expected, as these are the core reasons it was written).
  8. 8. Basic Commands ● Repository creation/Checkout gi t i ni t ( I ni t i al i ze a r eposi t or y) gi t c l one ( svn checkout )
  9. 9. Basic Commands ● Daily routine gi t s t at us ( Show t he wor ki ng t r ee st at us ) gi t add ( Add f i l e cont ent s t o t he i ndex ) gi t rm ( Rem ove f i l es f r om t he wor ki ng t r ee and f r om t he i ndex ) gi t c om i t ( Recor d changes t o t he r eposi t or y) m
  10. 10. Basic Commands ● Big Brother gi t di f f ( Show changes bet ween com i t s, m com i t and wor ki ng t r ee, et c ) m gi t bl am ( Show what r evi si on and aut hor l ast e m odi f i ed each l i ne of a f i l e ) gi t bi s ec t ( Fi nd by bi nar y sear ch t he change t hat i nt r oduced a bug)
  11. 11. Branching & Merging ● branch & merge – Extremely fast – keep your room clean – Try new things
  12. 12. Branching & Merging Branch best practices – Follow Vincent Driessen's branching model Driessen – Don’t directly work on master or Develop
  13. 13. Typical Workflow 1.New Branch 2.Coding 3.Commit 4.Push
  14. 14. Typical Workflow 1.New Branch 2.Coding 3.Commit $ git branch myNewBranch $ git checkout myNewBranch ------------Or-----------$ git checkout -b myNewBranch $ git status # On branch myNewBranch # Untracked files: # # MyNewFile.php # MyNewFile2.php $ git add MyNewFile.php MyNewFile2.php ------------Or-----------$ git add . $ git commit -m 'MyCommitMessage' 4.Push $ git push origin myNewBranch
  15. 15. Question?
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.