0
Version ControlBasicsNymgo team
Version ControlObjectives Understand basic elements andmanagement of the version control,  without entering in details of ...
Version ControlAgenda (1h)1.Basic vocabulary2.Parallel Worlds3.Branching Patterns4.Anti-Patterns
Main conceptsBASIC VOCABULARY
Version ControlEnvironment• Repository  Where files’ current and historical data are stored.• Server  A machine serving th...
Version ControlEnvironment                         Client            Server       Working copy            Repository
Version ControlBasic operations  • Add    Mark a file or folder to be versioned  • Change    Create any changes in the loc...
Version ControlBasic operations                  Revert                   Add   Foobar.txt                  Foobar.txt    ...
Version ControlBasic artifacts  • Revision    Set of changes, state of the code in a point of time  • Changelog    Sequent...
Version ControlArtefatos Básicos                                                                                          ...
Version ControlSynchronization  • Update    Synchronize changes from the repository to the local    copy
Version ControlSynchronization                  1219   1220   1221   1222      Jerry                                      ...
Version ControlLabels• Tags  Comprehensive alias for existing revisions, marking an  important snapshot in time
Version ControlLabels                                                     1.0.2              Tags                         ...
Version ControlChanges• Diffs and Patches  The comparison between two text files is done by an  application diff-like that...
Version ControlChanges – Example
Diff file or patch
Diff file or patch
Version ControlChanges                     diff 1      diff 2      diff 3          diff 4         1218     1219        122...
Concepts of branching, merging and conflictsPARALLEL WORLDS
Version ControlParallel Worlds Perhaps the most accessible way to think of branches is as parallel universes.Theyre places...
Version ControlParallel Worlds• Parallel universes offer unlimited  possibilities.• They also allow you to stay  safely en...
Version ControlParallel Worlds• Branch is like a parallel world.• Changes done in one branch  doesn’t have effect over the...
Version ControlBranches                           Z                               Create                               bra...
Version ControlMerge• In some point of the  development, the code must be  merged.
Version ControlMerge    X                  Merge              Y
Version ControlConflicts• When the changes are done in  the same source file lines, you  can have conflicts.
Version ControlHow to solve conflicts?
Version ControlHow to solve conflicts?                    Question:             Is it possible to solve                  t...
Version ControlHow to solve conflicts?           Answer: No!!!          Even when don’t have changes in          the same ...
Version ControlHow to solve conflicts?                A note before continuing:       It is always better to avoid        ...
Version ControlHow to solve conflicts?                  Two way merge         A                               A           ...
Tools: KDiff3
Version ControlHow to solve conflicts?                         Three way merge             B                              ...
Tools: KDiff3
Tools: choose one…       Guiffy SureMerge   Meld              DiffMerge             Ultracompare                          ...
Which one  should I use?  Choose one thatbest fits your team!
How to manage the branches during the software lifecycleBRANCHING PATTERNS
Version ControlMainline                              1.0.1   1.0               branch                                     ...
Version ControlMainline            Bring a fix from branch n to           branch m require m-n merges             (linear ...
Version ControlMainline                  Learned lesson:           Perform merges the early and              frequently as...
Version ControlMainline / Variant                                                                                       2....
Version Control                    Scenario:      You just developed a stable version of      the software and you need to...
Version ControlParallel Maintenance / Development Lines                            Most used option                       ...
Version ControlParallel Maintenance / Development Lines                           Note the internal branch                ...
Version Control                     Scenario:         You need to develop two different         features in a short period...
Version ControlOverlapping Release Lines     mainline                    branch                func_1                     ...
Version Control                   Scenario:       You allocated a new developer to      work in a too risky code base and ...
Version ControlDocking Line                   devel                                                          merge        ...
Version Control                    Scenario:         Your development tasks need to      progress in discrete levels of ma...
Version ControlStaged Integration Lines                     devel   (1)                 propostas         (2)             ...
Some most common patterns.WHEN TO CREATE A BRANCH?
Version ControlBranch per Delivery               1.0   1.1                  1.2         1.3 Release 1                     ...
Version ControlBranch per Task                    Task 1             1.0             1.1   1.2     Devel                  ...
Version ControlBranch per Component                    Component A             1.0                  1.1   1.2     Devel   ...
Version ControlBranch per Technology                                  1.1                  Android                        ...
What can happen if you don’t manage branchingANTI-PATTERNS
Anti-Pattern          DescriptionMerge Paranoia        avoiding merging at all cost, usually because of a fear of the cons...
Upcoming SlideShare
Loading in...5
×

Version Control Basics

946

Published on

This presentation shows basic concepts about revision control systems, common to all tools available in the market. It doesn't enter in details in any specific technology, but concentrates only on the concepts involved in those. There are a section related to branching patterns and anti-patterns too.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
946
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
28
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "Version Control Basics"

  1. 1. Version ControlBasicsNymgo team
  2. 2. Version ControlObjectives Understand basic elements andmanagement of the version control, without entering in details of a specific Version Control System.
  3. 3. Version ControlAgenda (1h)1.Basic vocabulary2.Parallel Worlds3.Branching Patterns4.Anti-Patterns
  4. 4. Main conceptsBASIC VOCABULARY
  5. 5. Version ControlEnvironment• Repository Where files’ current and historical data are stored.• Server A machine serving the repository.• Client The client machine connecting to the server.• Working copy Local copy where the developer changes the code.
  6. 6. Version ControlEnvironment Client Server Working copy Repository
  7. 7. Version ControlBasic operations • Add Mark a file or folder to be versioned • Change Create any changes in the local copy • Commit Send changes to the repository • Revert Discard local changes and go back to the same last known revision from the repository
  8. 8. Version ControlBasic operations Revert Add Foobar.txt Foobar.txt Commit Commit Change Delete Commit Revert Foobar.txt Foobar.txt
  9. 9. Version ControlBasic artifacts • Revision Set of changes, state of the code in a point of time • Changelog Sequential view of the changes done to the code, stored in the repository
  10. 10. Version ControlArtefatos Básicos Last revision (head) harry 1222 file1.txt Refactoring of module C. file2.txt Changelog file4.txt dick 1221 Including BUG B. file2.txt file4.txt tom 1220 Including feature A. file1.txt Revision file3.txt number fulano Revision 1219 file1.txt First inclusion author file2.txt file3.txt Description file4.txt message Changed files Revision
  11. 11. Version ControlSynchronization • Update Synchronize changes from the repository to the local copy
  12. 12. Version ControlSynchronization 1219 1220 1221 1222 Jerry Commit 1222 Server 1219 1220 1221 Update Tom 1219 1220 1221 1222
  13. 13. Version ControlLabels• Tags Comprehensive alias for existing revisions, marking an important snapshot in time
  14. 14. Version ControlLabels 1.0.2 Tags harry 1222 file1.txt Refactoring of module C. file2.txt file4.txt tom 1221 Including BUG B. file2.txt file4.txt dick 1220 Including feature A. file1.txt 1.0.1 file3.txt tom 1219 file1.txt First inclusion. file2.txt file3.txt file4.txt
  15. 15. Version ControlChanges• Diffs and Patches The comparison between two text files is done by an application diff-like that feeds an application patch-like capable of redo the changes from the originating state to the destination state. This operation of computing the differences is normally referred as diff, while the “file containing the differences”, that could be exchanged in e-mails and other eletronic media, is denominated patch.
  16. 16. Version ControlChanges – Example
  17. 17. Diff file or patch
  18. 18. Diff file or patch
  19. 19. Version ControlChanges diff 1 diff 2 diff 3 diff 4 1218 1219 1220 1221 1222
  20. 20. Concepts of branching, merging and conflictsPARALLEL WORLDS
  21. 21. Version ControlParallel Worlds Perhaps the most accessible way to think of branches is as parallel universes.Theyre places where, for whatever reason, history didnt go quite the same way as it did in your universe. From that point forward, that universe can be slightly different – or it can be radically and utterly transformed. Like the Marvel comicbook series “What If?”, branching lets you answer some interesting and possibly even dangerous "what if" questions with your software development.
  22. 22. Version ControlParallel Worlds• Parallel universes offer unlimited possibilities.• They also allow you to stay safely ensconced in the particular universe of your choice, completely isolated from any events in other alternate universes.
  23. 23. Version ControlParallel Worlds• Branch is like a parallel world.• Changes done in one branch doesn’t have effect over the another.• Although branching offers the seductive appeal of multiple possibility with very little risk, it also brings along something far less desirable: increase of complexity.
  24. 24. Version ControlBranches Z Create branch X Create branch Y Create branch W
  25. 25. Version ControlMerge• In some point of the development, the code must be merged.
  26. 26. Version ControlMerge X Merge Y
  27. 27. Version ControlConflicts• When the changes are done in the same source file lines, you can have conflicts.
  28. 28. Version ControlHow to solve conflicts?
  29. 29. Version ControlHow to solve conflicts? Question: Is it possible to solve these conflicts automatically?
  30. 30. Version ControlHow to solve conflicts? Answer: No!!! Even when don’t have changes in the same source line, you can still have semantic problems in the code. So, always double check before to commit.
  31. 31. Version ControlHow to solve conflicts? A note before continuing: It is always better to avoid unnecessary conflicts. Communicate your development, always include a description in your committed revisions, ask for help if you don’t understand anything, etc.
  32. 32. Version ControlHow to solve conflicts? Two way merge A A B working base working copy C=A+B B C output
  33. 33. Tools: KDiff3
  34. 34. Version ControlHow to solve conflicts? Three way merge B A B C Merge origin branch #1 branch #2 Create branchA C D D=A+B+C
  35. 35. Tools: KDiff3
  36. 36. Tools: choose one… Guiffy SureMerge Meld DiffMerge Ultracompare Notepad++ Apple Filemerge Araxis tkmerge TFS diffmerge xxdiff ...
  37. 37. Which one should I use? Choose one thatbest fits your team!
  38. 38. How to manage the branches during the software lifecycleBRANCHING PATTERNS
  39. 39. Version ControlMainline 1.0.1 1.0 branch merge 1.1.1 1.1.2 1.1 branch merge 1.2.1 1.2.2 1.2 branch merge merge 2.0.1 2.0
  40. 40. Version ControlMainline Bring a fix from branch n to branch m require m-n merges (linear complexity with the number of branches).
  41. 41. Version ControlMainline Learned lesson: Perform merges the early and frequently as possible.
  42. 42. Version ControlMainline / Variant 2.0.1 2.0 branch 1.2.1 1.2.2 merge 1.2 merge merge branch mainline branch branch merge merge 1.1 3.0 1.1.1
  43. 43. Version Control Scenario: You just developed a stable version of the software and you need to create a new version with new features and still provide small fixes for the last stable version.
  44. 44. Version ControlParallel Maintenance / Development Lines Most used option 1.1.1 1.1.2 1.1 merge merge 1.0.0 branch 2.0.1 devel
  45. 45. Version ControlParallel Maintenance / Development Lines Note the internal branch 2.0.1 2.0.2 2.0 merge merge branch 1.0.0 devel branch merge merge 1.1 1.1.1
  46. 46. Version Control Scenario: You need to develop two different features in a short period of time. (laughts)
  47. 47. Version ControlOverlapping Release Lines mainline branch func_1 merge branch merge merge func_2
  48. 48. Version Control Scenario: You allocated a new developer to work in a too risky code base and you want to moderate his/her changes for a while.
  49. 49. Version ControlDocking Line devel merge merge merge moderador sync sync sync docking line change, change, change, stabilize stabilize stabilize desenvolvedor
  50. 50. Version Control Scenario: Your development tasks need to progress in discrete levels of maturity: (1) change proposals, (2) analysis, (3) review, (4) unit tests, (5) integration tests, (6) system tests, etc.
  51. 51. Version ControlStaged Integration Lines devel (1) propostas (2) revisão (3) testes
  52. 52. Some most common patterns.WHEN TO CREATE A BRANCH?
  53. 53. Version ControlBranch per Delivery 1.0 1.1 1.2 1.3 Release 1 Create Merge branch Release 2 2.0 2.1 2.2 2.3
  54. 54. Version ControlBranch per Task Task 1 1.0 1.1 1.2 Devel Task 2
  55. 55. Version ControlBranch per Component Component A 1.0 1.1 1.2 Devel Components A + B Component B
  56. 56. Version ControlBranch per Technology 1.1 Android 1.1 1.2 Common 1.1 1.2 iOS
  57. 57. What can happen if you don’t manage branchingANTI-PATTERNS
  58. 58. Anti-Pattern DescriptionMerge Paranoia avoiding merging at all cost, usually because of a fear of the consequences.Merge Mania spending too much time merging software assets instead of developing them.Big-Bang Merge deferring branch merging to the end of the development effort and attempting to merge all branches simultaneously.Nerver-Ending Merge continuous merging activity because there is always more to merge.Wrong-Way Merge merging a software asset version with an earlier version.Branch Mania creating many branches for no apparent reason.Cascading Branches branching but never merging back to the main line.Mysterious Branches branching for no apparent reason.Temporary Branches branching for changing reasons, so the branch becomes a permanent temporary workspace.Volatile Branches branching with unstable software assets shared by other branches or merged into another branch. Note Branches are volatile most of the time while they exist as independent branches. That is the point of having them. The difference is that you should not share or merge branches while they are in an unstable state.Development Freeze stopping all development activities while branching, merging, and building new base lines.Berlin Wall using branches to divide the development team members, instead of dividing the work they are performing.
  1. A particular slide catching your eye?

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

×