Version Control Systems



Similar documents
Version Control with. Ben Morgan

Continuous Integration. CSC 440: Software Engineering Slide #1

Version Control with Subversion

Version Control Systems (Part 2)

Introduction to Git. Markus Kötter Notes. Leinelab Workshop July 28, 2015

Source Code Management/Version Control

Revision control systems (RCS) and

Version Control Tools

Distributed Version Control with Mercurial and git

Introduction to Version Control

Source Control Systems

Version Uncontrolled! : How to Manage Your Version Control

CSE 374 Programming Concepts & Tools. Laura Campbell (Thanks to Hal Perkins) Winter 2014 Lecture 16 Version control and svn

CPSC 491. Today: Source code control. Source Code (Version) Control. Exercise: g., no git, subversion, cvs, etc.)

Version control. HEAD is the name of the latest revision in the repository. It can be used in subversion rather than the latest revision number.

Version Control with Git. Linux Users Group UT Arlington. Rohit Rawat

Lab Exercise Part II: Git: A distributed version control system

Version Control with Svn, Git and git-svn. Kate Hedstrom ARSC, UAF

COSC Software Engineering. Lecture 7: Version Control

Version control with GIT

Version Control with Git. Dylan Nugent

Version Control and Subversion. Dr Paul Tennent

Git Basics. Christopher Simpkins Chris Simpkins (Georgia Tech) CS 2340 Objects and Design CS / 22

Version Control with Git. Kate Hedstrom ARSC, UAF

Using Git for Project Management with µvision

Data management on HPC platforms

Version Control Systems: SVN and GIT. How do VCS support SW development teams?

An Introduction to Mercurial Version Control Software

Local Version Control (sccs, rcs)

Using Subversion in Computer Science

The Bazaar Version Control System. Michael Hudson, Canonical Ltd

Source code management systems

Version Control with Subversion and Xcode

Introduction to Subversion

CISC 275: Introduction to Software Engineering. Lab 5: Introduction to Revision Control with. Charlie Greenbacker University of Delaware Fall 2011

Version Control for Computational Economists: An Introduction

Integrated version control with Fossil SCM

Annoyances with our current source control Can it get more comfortable? Git Appendix. Git vs Subversion. Andrey Kotlarski 13.XII.

FEEG Applied Programming 3 - Version Control and Git II

Version Control. Luka Milovanov

Version Control with Git

Version Control! Scenarios, Working with Git!

Table of Contents. The RCS MINI HOWTO

Technical Writing - Advantages of Version Control Systems

Git Basics. Christian Hanser. Institute for Applied Information Processing and Communications Graz University of Technology. 6.

Version control. with git and GitHub. Karl Broman. Biostatistics & Medical Informatics, UW Madison

A brief introduction to CVS

Introducing Xcode Source Control

Two Best Practices for Scientific Computing

Software configuration management

SOFTWARE DEVELOPMENT BASICS SED

Software Configuration Management and Continuous Integration

Derived from Chris Cannam's original at, an.

Git. A Distributed Version Control System. Carlos García Campos carlosgc@gsyc.es

Version Control with Mercurial and SSH

Version Control. Version Control

Mercurial. Why version control (Single users)

Distributed Version Control

using version control in system administration

CVS versus BitKeeper A Comparison

Content. Development Tools 2(63)

Version Control Tutorial using TortoiseSVN and. TortoiseGit

Modulo II Software Configuration Management - SCM

PKI, Git and SVN. Adam Young. Presented by. Senior Software Engineer, Red Hat. License Licensed under

MATLAB & Git Versioning: The Very Basics

Introduction to the Git Version Control System

Introduc)on to Version Control with Git. Pradeep Sivakumar, PhD Sr. Computa5onal Specialist Research Compu5ng, NUIT

Version Control Script

RANCID and CVS. PacNOG 6 Nadi, Fiji

Software Configuration Management. Slides derived from Dr. Sara Stoecklin s notes and various web sources.

Pro Git. Scott Chacon *

Software Delivery Integration and Source Code Management. for Suppliers

Environnements et Outils de Développement Cours 7 Version Control

Version Control using Git and Github. Joseph Rivera

Week G Versioning with svn

Introduction to Software Engineering (2+1 SWS) Winter Term 2009 / 2010 Dr. Michael Eichberg Vertretungsprofessur Software Engineering Department of

An Introduction to Collaborating with Version Control

KEY FEATURES OF SOURCE CONTROL UTILITIES

Work. MATLAB Source Control Using Git

Version control systems. Lecture 2

Using SVN to Manage Source RTL

Lab 2 : Basic File Server. Introduction

Version Control with Subversion

Managing Software Projects Like a Boss with Subversion and Trac

SVN Starter s Guide Compiled by Pearl Guterman June 2005

Version Control Using Subversion. Version Control Using Subversion 1 / 27

Software Development and Collaboration: Version Control Systems and Other Approaches

Code Management With CVS Or Submission With Subversion. Gary Kedziora ANL August 19, 2005

Subversion. Nadir SOUALEM. Linux Users subversion client svn or higher. Windows users subversion client Tortoise 1.6.

Dalhousie University CSCI 2132 Software Development Winter 2015 Lab 7, March 11

Git - Working with Remote Repositories

Using SVN to Manage Source RTL

Working with a Version Control System

An Introduction to Git Version Control for SAS Programmers

Introduction to Version Control with Git

Advanced Computing Tools for Applied Research Chapter 4. Version control

Setting up a local working copy with SVN, MAMP and rsync. Agentic

Miguel A. Figueroa Villanueva Xabriel J. Collazo Mojica

How to set up SQL Source Control. The short guide for evaluators

CS 103 Lab Linux and Virtual Machines

Transcription:

Version Control Systems ESA 2015/2016 Adam Belloum a.s.z.belloum@uva.nl Material Prepared by Eelco Schatborn

Today IntroducGon to Version Control Systems Centralized Version Control Systems RCS CVS SVN Decentralized Version Control Systems Git, (wrinen in C) used by the Linux Kernel and Ruby on Rails. Mercurial, (wrinen in Python) used by Mozilla and OpenJDK Bazaar (wrinen in Python) used by Ubuntu developer Darcs, (wrinen in Haskell).

Version Control systems A version control system provides support for the development of so6ware in pargcular. documengng an annotated history of a project is a complex ma9er (changes, bugs) mulgple editors in use, keep developers from overwrigng each others work backtracking to a previous version branching

Version Control Systems Most important Unix Version Control programs SCCS (Source Code Control System) Bell Labs, 1980. Proprietary. IntroducGon of most important concepts. Not used much anymore. RCS (Revision Control System) Purdue University, early 80's. Open source. Basis of CVS. CVS (Concurrent Version System) Early 90's. Maintained by FSF (Free So^ware FoundaGon) SVN (Subversion) Early 2000. CollabNet

Today IntroducGon to Revision Version Control Systems Centralized Version Control Systems RCS CVS SVN Decentralized Version Control Systems GIT

Centralized Version Control Systems It s like having your source files on a File server and coordinate with your colleagues on the version number you re working on. By Durai Raj CVS Concurrent Versioning System

How Does centralized VCS Work? centralized VCS uses a client / server architecture A sys admin would normally install the server The Server Maintains THE repository Developers use the client The client allows for checking in/out, and UpdaGng, etc.. By Durai Raj CVS Concurrent Versioning System

Versioning Systems Versioning Systems allow: mulhple users to modify the same code To store ONE master copy of the source code To automate the update between versions Access to any previous state of the source code

VCS do s and don'ts Facilitates bug detechon when so^ware is modified Economy in disk space while saving versions Prevents code over- wrihng in a team project Not a build system Not a subshtute for communicagon between developers or for management It will not create any magic for you. By Durai Raj CVS Concurrent Versioning System

Check- In, and Check- Out The version file for a document contains extra administrahve informahon before you can go and look at or change a file, a working version has to be created; this is called check-out. If you want to make changes, PUT a lock on the file at check- out (Very OLD WAY, RCS) submigng your changes to a file to the system is called a check-in

Check- In, Check- Out: commands ci co Check- in: put the work file into the version file; à create the version file if it does not exist. The system requests a descripgon of the changes Check- out: create a new work file from the version file (read- only) co -l Check- out with lock; write permissions co -rn Check- out file with revision number N

Check- In, Check- Out: Example file Check-In file -----------------------> file,v [version 1.1] Check-Out -lock file file <---------------- edit file Check-In file -----------------------> file,v [version 1.2] Check-Out - Revision number file file <---------------- [old version]

Revision numbering Numbering starts with 1.1 With every check- in the second number is increased by 1 The first number can be increased by using the - r opgon; for instance, using check-in revision 2 will set the revision number to 2.1 1.1 1.2 1.3 1.4 1.5

When to commit Commit to mark a working state that you might want to return to later. Commit related files in a single operagon. Use a common log message for all the files. (useful but not very wise if the code is not fully tested!!!) Commit to backup your sources Commit from an office desktop to be able to access the files from home much faster than through filesystem sharing. By Durai Raj CVS Concurrent Versioning System

CollaboraGon (old Gme) If a user A locked a file using check-out -lock, he or she gets write permissions on the file If user B the tries to lock the file in the same way, a warning is given that the file is locked B can decide to go forward anyway, in which case A will get a warning (by email)

RCS InformaGon InformaGon in a revision can be added to the working file The informagon itself is part of the version file To copy that informagon to the working file during check- out one uses keywords for example use: Id to insert informagon on the author, date, version envelop the keyword with $... $ Other keywords are Author, Log, Date, Locker,...

Branching say you are working with version 2.5, but want to start an alternahve development from version 1.8 using checkout -l -r1.8 a working file can be created from version 1.8 Note: should you check- in that file you would get version 2.6! use ci -r1.8.1 to start a new branch from version 1.8 (first new version is 1.8.1.1)

Branch if you need... to create sustaining (patch) releases to have multiple development lines from a single repository to do experimental development to merge later or forget about it to keep temporary state of development without affecting builds By Durai Raj CVS Concurrent Versioning System

Concurrent checkout Master Repository foo.c Checkout does not lock the files in repository Ganesh Working Copy V1.7 checkin V1.8 or 1.9 Subbu checkout V1.1 Working Copy V1.1 X checkout V1.2 Gopinath Working Copy V1.2 X checkin prohibited Sundar Mansoor (Code walkthrough) Working Copy V1.7 checkin V1.8 or 1.9 Working Copy V1.2.2.1 checkin V1.2.2.2 By Durai Raj CVS Concurrent Versioning System

Merge Branches can be merged. Say a file is a work file for revision 1.8.1.3, then rcsmerge -r1.8 -r2.5 file will give a merge of the file with version 2.5. A check- in will now create version 2.6. A merge operagon looks at the differences between two versions an places as much as possible into the new file. If there is a conflict it will be shown between <<<<<< and >>>>>>

Today IntroducGon to Revision Version Control Systems Centralized Version Control Systems RCS CVS SVN Decentralized Version Control Systems GIT

CVS: Concurrent Version System inihally a front- end to RCS newest implementagons are no longer dependent on RCS they do use the RCS format for the version file more funchonality than RCS, more complex interface, RCS can be used for small projects with few Editors CVS can handle large projects with many designers in different places (worldwide) no exclusive locks

THE Repository CVS keeps the version files for a project in a CVS repository a directory on a machine reachable by all pargcipants (CVS server) people can work locally or remotely through ssh. In both cases the environment variable CVSROOT must point to the repository The repository can be split up into modules - - a group of files and/or directories to work on module foo a working directory has to be created Using cvs checkout foo CVS then creates a subdirectory foo containing the work files of the foo module

Example checkout $ cvs checkout foo cvs checkout: Updating foo U foo/.cvsignore U foo/file1 U foo/file2 U foo/file3 $ ls foo CVS file1 file2 file3

Commit and Update A^er making changes a check- in can be done file using cvs commit if more than one person is working on the module it is standard pracgce to do an update first using cvs update an update will check if others have commined anything since your last check- out if so, your last work file will be merged with the latest version

Example update $ cvs update cvs update: Updating. U file1 U file2 RCS file: <CVSROOT-path>/foo/file3,v retrieving revision 1.4 retrieving revision 1.5 Merging differences between 1.4 and 1.5 into file3 M file3 $

Commit if your files have been merged a^er an update you should check if everything STILL works Then do another update $ cvs update cvs update: Updating. M file3 CVS tells us file3 is the only file you have adapted, no others have commined the file since your last update using cvs commit file3 you can check- in the file

Log message A^er the cvs commit command CVS will open an editor ($CVSEDITOR) so that a descripgon of the changes can be given Very important advise: DONOT PUT DUMMY TEXT, explain exactly what you did

The CVSROOT module To inigalize the repository run: cvs init in the root directory CVSROOT A^er the command the CVSROOT directory contains the special module CVSROOT That module contains configuragon informagon on the repository

StarGng a new module When a new project is started a new module must be created in the repository using cvs import 1. go to the directory you wish to import 2. use: cvs import <module name> <vendor tag> <release tag> 3. CVS will then ask you to type in informagon on the project in an editor

Import Example $ mkdir example $ mv file* example/ $ cd example $ cvs import example example_project ver_0_0 A module example is now made; the example directory in the repository contains the version files file1,v and file2,v

Adding and removing files adding a file to a module 1. put the file in the work directory 2. cvs add <file> removing a file from a module 1. first remove the file from your working directory 2. cvs remove <file> Note Directories cannot be removed All changes are made at the next commit command

Viewing changes cvs log <file> command gives an overview of the log data of a file. Who made what changes and when. cvs diff -c -r 1.6 -r 1.7 <file> will give a list of differences between version 1.6 and 1.7

Tagging a project MyProject can be given a tag MyTag to which you can refer later on revision number can be referred to, but each file can have a different version number use the command cvs tag MyTag in the working directory of the module a tagged version can be retrieved using cvs checkout -rmytag MyProject there is always one central branch, the `trunk the tag name for the latest revision of the trunk is always HEAD

Branching CVS work with branches in terms of tags a branch tag refers to the branch use the command cvs tag -b <branchname> in the work directory of the module to be branched use the command cvs checkout -r <branchname> to get a working copy of a branch, if you commit now the new revision will be added to the branch

By Durai Raj CVS Concurrent Versioning System

Working on branches cvs tag -b rel_1_fix patch 1.2.2.1 1.2.2.2 1.1 1.2 1.3 release_1 1.4 release_2 cvs up -r rel_1_fix cvs tag release_1 cvs tag release_2 By Durai Raj CVS Concurrent Versioning System

Merging to merge a branch with HEAD use cvs update j branchname this gives a new version of the trunk a warning rcsmerge: warning: conflicts during merge if there are conflicts with a certain file if that happens a copy of the HEAD version is kept as.file1.5 (file is the name and 1.5 the revision number) in the le itself CVS will mark the lines where the conflicts are (between <<<<<< and >>>>>>)

WinCVS: Configuration hnp://cvsgui.sourceforge.net/index.html Your login By Durai Raj CVS Concurrent Versioning System

state icon revision number file type WinCvs: Main screen file view modules status view By Durai Raj CVS Concurrent Versioning System

Checking out the sources By Durai Raj CVS Concurrent Versioning System

Source history & diff By Durai Raj CVS Concurrent Versioning System

Commit, Update & Tag By Durai Raj CVS Concurrent Versioning System

Today IntroducGon to Version Control Systems Centralized Version Control Systems RCS CVS SVN Decentralized Version Control Systems GIT

Subversion (SVN) Project summary A compelling replacement for CVS Offers the funcgonality of CVS using more or less the same interface BeNer implementagon

Differences with CVS Atomic commit When you commit a group of files, they should either be successfully commined, or not at all. CVS allows for pargal commits Renaming in CVS renaming can only be done by creagng a new file, adding it to the repository and removing the old one. That way all version informagon on a file is lost. SVN provides move. Versioning directories directories can also be moved and renamed in SVN Binary diffs The diff mechanism of CVS is geared towards text files, which makes it very inefficient when working with binary files. SVN improves on that

Differences with CVS Revision numbering in CVS files are numbered individually. In SVN the whole module is numbered CVS: revision 2.6 of <file> is always different from revision 2.7 SVN: it does not have to be a difference between revision 30 and revision 31 for a given file

Subversion Commands co/checkout ci/commit up/update add, remove/rm cp/copy mv/move Log diff

Today IntroducGon to Version Control Systems Centralized Version Control Systems RCS CVS SVN Decentralized Version Control Systems GIT

GIT a distributed revision control system. most features from Subversion idengcal interface file handling (binary, etc) more branching oriented everyone keeps Its own root, you can merge with other People manual access control (YOU decide who to merge with) see hnp://git- scm.com/

Snapshots, Not Differences most other systems store informagon as a list of file- based changes hnp://progit.org/book/ch1-3.html

Snapshots, Not Differences a set of snapshots of a mini filesystem hnp://progit.org/book/ch1-3.html

Nearly Every OperaHon Is Local Most operagons in Git only need local files and resources to operate generally no informagon is needed from another computer on your network. Because you have the engre history of the project right there on your local disk, most operagons seem almost instantaneous. hnp://progit.org/book/ch1-3.html

Git Has Integrity Everything in Git is check- summed before it is stored and is then referred to by that checksum. This means it s impossible to change the contents of any file or directory without Git knowing about it. FuncGonality built into Git at the lowest levels and is integral to its philosophy. You can t lose informahon in transit or get file corrupgon without Git being able to detect it. Mechanism that Git uses for this check summing is called a SHA- 1 hash. This is a 40- character string composed of hexadecimal characters (0 9 and a f) and calculated based on the contents of a file or directory structure in Git. hnp://progit.org/book/ch1-3.html

Git Generally Only Adds Data When you do acgons in Git, nearly all of them only ADD data to the Git database. difficult to get the system to do anything that is not undoable or to make it erase data in any way. As in any VCS, you can lose or mess up changes you haven t commined yet; but a^er you commit a snapshot into Git, it is very difficult to lose, especially if you regularly push your database to another repository. hnp://progit.org/book/ch1-3.html

GIT Three States Git has three main states that your files can reside in: commined, modified, and staged Commi9ed file is stored in the local database. Modified file is modified but have not commined it to the database yet. Staged file is marked a modified file in its current version to go into the next commit snapshot. hnp://progit.org/book/ch1-3.html hnp://gitolite.com/uses- of- index.html

Skipping the Staging Area Although it can be useful for cra^ing commits exactly how you want them, the staging area is somegmes a bit more complex than you need in your workflow. You can skip the staging area, Git provides a simple shortcut. - a opgon to the git commit command makes Git automagcally stage every file that is already tracked before doing the commit, legng you skip the git add hnp://progit.org/book/ch2-2.html

IniHalizing a Repository in an ExisHng Directory start to track an exisgng project in Git, go to the project s directory and type: $ git init start version- controlling exisgng files (as opposed to an empty directory), do an inigal commit on these files: $ git add *.c $ git add README $ git commit -m 'initial project version hnp://progit.org/book/ch2-2.html

Cloning an ExisHng Repository get a copy of an exisgng Git repository $ git clone git://github.com/schacon/grit.git [mygrit] important disgncgon: Git receives a copy of nearly all data that the server has. Every version of every file for the history of the project is pulled down hnp://progit.org/book/ch2-2.html

Cloning an ExisHng Repository Checking the Status of Files $git status Tracking New Files $ git add file Staging Modified Files $ git add file Commigng Your Changes $ git commit Removing Files $ rm file; git rm file Moving Files $ git mv file1 file2 Ignoring Files create a.gitignore file hnp://progit.org/book/ch2-2.html