Presentation is loading. Please wait.

Presentation is loading. Please wait.

4 Version control (part 1)

Similar presentations


Presentation on theme: "4 Version control (part 1)"— Presentation transcript:

1 4 Version control (part 1)
Objektorienterade applikationer d2, förel. 4 4 Version control (part 1) (Hodson: 1, Chacon: 1-2) DAT055, 16/17, lp 3

2 Main concepts to be covered
Objektorienterade applikationer d2, förel. 4 Main concepts to be covered Local version control Centralized version control Distributed version control Systems for version control Version control principles and concepts Version control with GIT Distributed workflow Objektorienterade applikationer, DAT055, DAI2, 16/17, lp 3 DAT055, 16/17, lp 3

3 Objektorienterade applikationer d2, förel. 4
Why version control? Manual file handling does not scale well for large projects. None or weak support for cooperation or distributed work. A simple linear development thread is the only realistic workflow. Objektorienterade applikationer, DAT055, DAI2, 16/17, lp 3 DAT055, 16/17, lp 3

4 Objektorienterade applikationer d2, förel. 4
Local version control Files maintained manually in directories. Error prone. In the rcs system, patch sets are used to keep track of the versions of a file. Objektorienterade applikationer, DAT055, DAI2, 16/17, lp 3 DAT055, 16/17, lp 3

5 Centralized version control
Objektorienterade applikationer d2, förel. 4 Centralized version control One single repository runs on a server. All developers are depending on the availability of the server. Project stops if the server crashes. Central VCS server Version database Version 1 Version 2 Version 3 Computer A file Computer B Objektorienterade applikationer, DAT055, DAI2, 16/17, lp 3 DAT055, 16/17, lp 3

6 Distributed version control
Objektorienterade applikationer d2, förel. 4 Distributed version control Developers work independently on own complete copies of the project files. Lower risk for data loss due to crashes. Efficient since most changes are performed on local copies. Objektorienterade applikationer, DAT055, DAI2, 16/17, lp 3 DAT055, 16/17, lp 3

7 Distributed version control
Objektorienterade applikationer d2, förel. 4 Distributed version control Server computer Version database Version 1 Version 2 Version 3 Computer A Version database Version 1 Version 2 Version 3 file Computer B Version database Version 1 Version 2 Version 3 file Objektorienterade applikationer, DAT055, DAI2, 16/17, lp 3 DAT055, 16/17, lp 3

8 Objektorienterade applikationer d2, förel. 4
Acronyms VC = Version Control VCS = Version Control System CVCS = Centralized Version Control System DVCS = Distributed Version Control System Objektorienterade applikationer, DAT055, DAI2, 16/17, lp 3 DAT055, 16/17, lp 3

9 Systems for version control
Objektorienterade applikationer d2, förel. 4 Systems for version control CVS A centralized VCS. The “old standard”. Subversion (SVN), Perforce, Bazaar, … git A distributed VCS. Inventor: Linus Torvalds First intended for development of Linux. Resource efficient. Widespread! Objektorienterade applikationer, DAT055, DAI2, 16/17, lp 3 DAT055, 16/17, lp 3

10 Traditional version control
Objektorienterade applikationer d2, förel. 4 Traditional version control file C Version 1 file B file A Δ1 Version 2 Δ2 Version 3 Version 4 Δ3 Version 5 Revision history Changes Original files Objektorienterade applikationer, DAT055, DAI2, 16/17, lp 3 DAT055, 16/17, lp 3

11 Git snapshots of a file system
Objektorienterade applikationer d2, förel. 4 Git snapshots of a file system Revision history file C Version 1 file B file A C1 Version 2 B A1 C2 Version 3 Version 4 B1 A2 C3 Version 5 B2 Unchanged files are represented as links to earlier versions Snapshot of a directory Only changed files are stored again Objektorienterade applikationer, DAT055, DAI2, 16/17, lp 3 DAT055, 16/17, lp 3

12 Version control concepts
Objektorienterade applikationer d2, förel. 4 Version control concepts Repository (“repo”) A database of a project’s revision history. Commit (Checkin) Uploading a changed file to the repository. Checkout Downloading a version of a file from the repo. A note on syntax: A B earlier version later version Objektorienterade applikationer, DAT055, DAI2, 16/17, lp 3 DAT055, 16/17, lp 3

13 Version control concepts
Objektorienterade applikationer d2, förel. 4 Version control concepts Branch A parallel line of development in a project. Merge Creating a common line from two branches. Conflicts may occur! Objektorienterade applikationer, DAT055, DAI2, 16/17, lp 3 DAT055, 16/17, lp 3

14 Objektorienterade applikationer d2, förel. 4
Git concepts Working directory Working directory A folder containing files Snapshot (revision) Staging area Intermediate storage of files in a snapshot. Repository A database of snapshots of a project history. Objektorienterade applikationer, DAT055, DAI2, 16/17, lp 3 DAT055, 16/17, lp 3

15 Checkout, Stage and Commit
Objektorienterade applikationer d2, förel. 4 Checkout, Stage and Commit Checkout Repository History Working directory Stage Commit Staged Snapshot Objektorienterade applikationer, DAT055, DAI2, 16/17, lp 3 DAT055, 16/17, lp 3

16 Objektorienterade applikationer d2, förel. 4
Stage and Unstage Unstage Working directory Stage Staged Snapshot Objektorienterade applikationer, DAT055, DAI2, 16/17, lp 3 DAT055, 16/17, lp 3

17 Workflow with local development branches
Objektorienterade applikationer d2, förel. 4 Workflow with local development branches Repo Working directory Stage Commit Staged Snapshot History Objektorienterade applikationer, DAT055, DAI2, 16/17, lp 3 DAT055, 16/17, lp 3

18 Objektorienterade applikationer d2, förel. 4
Branching feature A main branch V 1 V 2 V 3 V 4 V 5 V x V y topic branch feature B Objektorienterade applikationer, DAT055, DAI2, 16/17, lp 3 DAT055, 16/17, lp 3

19 Merging two development branches
Objektorienterade applikationer d2, förel. 4 Merging two development branches Version 6 contains both feature A and B V 1 V 2 V 3 V 4 V 5 V 6 V x V y Objektorienterade applikationer, DAT055, DAI2, 16/17, lp 3 DAT055, 16/17, lp 3

20 Objektorienterade applikationer d2, förel. 4
Merge conflicts Snapshots V 5 and V y contain conflicting data V 1 V 2 V 3 V 4 V 5 V x V y Conflicts have to be resolved by the developer(s) Objektorienterade applikationer, DAT055, DAI2, 16/17, lp 3 DAT055, 16/17, lp 3

21 Integrator-Manager Workflow
Objektorienterade applikationer d2, förel. 4 Integrator-Manager Workflow The integrator pushes to a public repo. Each developer clones the public repo into a local copy and makes changes. Changes are pushed to an own public repo with write access. The integrator pulls in and merges contributions from the public repos. The integrator pushes merged changes to the “official” public repo. Objektorienterade applikationer, DAT055, DAI2, 16/17, lp 3 DAT055, 16/17, lp 3

22 Integrator-Manager Workflow
Objektorienterade applikationer d2, förel. 4 Integrator-Manager Workflow Main repo Public repo 1 Public repo 2 Public repo 3 2. Clone 1. Push 5. Push 3. Push 4. Pull in contributions Local repo Integration manager Developer 2: Main Local repo 2 B Developer 3: Feature B Local repo 3 Local repo 1 A Developer 1: Feature A Main Objektorienterade applikationer, DAT055, DAI2, 16/17, lp 3 DAT055, 16/17, lp 3


Download ppt "4 Version control (part 1)"

Similar presentations


Ads by Google