Distributed Version Control



Similar documents
Distributed Version Control with Mercurial and git

Version Control using Git and Github. Joseph Rivera

Work. MATLAB Source Control Using Git

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

Version control with GIT

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

Version Control! Scenarios, Working with Git!

Advanced Computing Tools for Applied Research Chapter 4. Version control

Source Control Systems

Version Control Systems

Revision control systems (RCS) and

Version Control with Subversion

An Introduction to Mercurial Version Control Software

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

FEEG Applied Programming 3 - Version Control and Git II

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

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

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

CS 2112 Lab: Version Control

Two Best Practices for Scientific Computing

Version Uncontrolled! : How to Manage Your Version Control

BlueJ Teamwork Tutorial

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

Version Control with Git. Dylan Nugent

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

Beginning with SubclipseSVN

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

Version Control. Version Control

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

MOOSE-Based Application Development on GitLab

Using Git for Project Management with µvision

Version Control Tools

CSCB07 Software Design Version Control

Using GitHub for Rally Apps (Mac Version)

Software Configuration Management and Continuous Integration

Introducing Xcode Source Control

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

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

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

Content. Development Tools 2(63)

Chapter 13 Configuration Management

Using Subversion in Computer Science

Source code management systems

Introduction to the Git Version Control System

Data management on HPC platforms

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.

The Hitchhiker s Guide to Github: SAS Programming Goes Social Jiangtang Hu d-wise Technologies, Inc., Morrisville, NC

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

Version Control with Subversion and Xcode

Version Control. Luka Milovanov

Version Control for Computational Economists: An Introduction

Modulo II Software Configuration Management - SCM

See the installation page

Introduction to Version Control

UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division. P. N. Hilfinger

Git, GitHub & Web Hosting Workshop

Version Control Tutorial using TortoiseSVN and. TortoiseGit

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

MATLAB & Git Versioning: The Very Basics

Source Code Management/Version Control

Version Control with Git. Kate Hedstrom ARSC, UAF

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

Introduction to Subversion

Subversion workflow guide

Software Version Control With Mercurial and Tortoise Hg

MapGuide Open Source Repository Management Back up, restore, and recover your resource repository.

Revision Control. Solutions to Protect Your Documents and Track Workflow WHITE PAPER

Using Git for Centralized and Distributed Version Control Workflows - Day 3. 1 April, 2016 Presenter: Brian Vanderwende

Version Control with Subversion

Software Delivery Integration and Source Code Management. for Suppliers

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

SVN Starter s Guide Compiled by Pearl Guterman June 2005

using version control in system administration

4D v11 SQL Release 6 (11.6) ADDENDUM

Installation of PHP, MariaDB, and Apache

Version control tracks multiple versions. Configuration Management. Version Control. V Software Engineering Lecture 12, Spring 2008

Platform as a Service and Container Clouds

Unity Version Control

C Programming Review & Productivity Tools

LATEX Document Management with Subversion

Release Notes. Asset Control and Contract Management Solution 6.1. March 30, 2005

How to Create a Free Private GitHub Repository Educational Account

Source Code Control & Bugtracking

The FOSSology Project Overview and Discussion. » The Open Compliance Program. ... By Bob Gobeille, Hewlett-Packard

EAE-MS SCCAPI based Version Control System

Unifying Authorization Models

Version control with Subversion

Software Requirement Specification for Web Based Integrated Development Environment. DEVCLOUD Web Based Integrated Development Environment.

Microsoft Visual Studio Integration Guide

Transcription:

Distributed Version Control Faisal Tameesh April 3 rd, 2015 Executive Summary Version control is a cornerstone of modern software development. As opposed to the centralized, client-server architecture implemented by programs like Subversion (SVN), distributed version control is pioneered by Git. This application note will discuss the benefits of distributed version control, followed by specific examples of how to implement the concepts to maximize productivity in a professional software engineering environment. Keywords Git Subersion Distributed Centralized - Version Control

Definition Version control is a method used to track code. Any edits by developers are tracked. Version controlled projects can be forked to be used as a basis in new projects, which promotes an open community of development. Version control promotes experimentation on existing code without worry that the pre-existing working code will break. Background Software engineering relies upon the same development cycle that other engineering disciplines implement. - Define the problem - Do background research - Specify requirements - Brainstorm solutions - Choose the best solution - Do development work - Build a prototype - Test and redesign Focusing specifically on the last four elements, version control plays a significant role in speeding up the process by maintaining an archive of all the added changes that were committed to the repository. Multiple solutions can be implemented as branches in the development and prototyping processes. Lastly, code testing and redesign, formally known as Test-Driven Development, is another cornerstone methodology of software engineering that version control makes more manageable. History One of the earliest revision control systems, Source Code Control System (SCCS), was geared towards program source code and other text files. It was originally developed in SNOBOL at Bell Labs in 1972 by Marc Rochkind for an IBM System/370 computer running OS/360 MVT. It was later rewritten by the same person in C for UNIX. Subsequently, SCCS was included in AT&T s commercial System III and System V distributions. SCCS was the dominant version control system for UNIX until later version control systems, notably RCS, which later became CVS, gained more widespread adoption. Today, these version control systems are obsolete, particularly in the open source community, which has largely embraced distributed revision control systems.

Version Control Architectures Git is the most popular of the distributed version control systems available today. It is important to distinguish between the concepts of distributed version control (like Git) and centralized version control (like SVN). Figure 1. Distributed vs. Centralized version control systems As can be seen in Figure 1, the distributed version control system does not depend upon having a central server where the repository information is contained. This allows for far greater flexibility in terms of internet connectivity and concurrency. In the centralized scenario, there must always be a connection to the server in order to commit code, whereas in the distributed system, committing the code happens on the local machine to the local version of the code. When sharing code using the distributed architecture, the system will merge the code changes based on the timestamps and changes that took place in the code. In rare cases, the centralized system also demonstrates some concurrency issues. When there is a large number of commits to the centralized system, some commits may occur before others, which, if incorrectly managed, will lead to the loss, or even incorrect modification, of existing code. While there are systems that manage problems that may arise with such architecture, they still happen, since concurrency is a difficult problem to fully solve in such systems.

The distributed system has no such problems. This is because each person has a local version of the code. Whenever code is merged, it happens only between two versions of the code: the local version and the remote version. These changes can be merged via some available algorithms that the program does automatically; the user simply has to provide which algorithm to use for the merging process, and if he/she does not, a default one will be used. Merging Strategies In Git, these algorithms are called merging strategies. There are some basic elements to consider when discussing merging strategies. 1) The Source: This is the change set to merge from. 2) The Destination: The change set to merge to. 3) The Ancestor: The change set which is the nearest parent of The Source and The Destination. Recursive: This is the default strategy. The algorithm looks at the ancestry of both versions until a common ancestor is found. It then uses this information as a basis to continue merging the two versions. Octopus: This merge strategy is used when there are several trees that need to be merged. This is used in large projects where many branches have had independent development and all of the parts must now come together. This is the default when the merge command is invoked manually, rather when merge is automatically called upon pulling code from a remote repository. In the latter case, the recursive algorithm is still the default. Ours: This strategy pulls in the Destination s head (which is the most recent version of the change set), but throws away all the changes the head introduces. While this seems counterintuitive, this is used to maintain the history of a branch without any of the effects of a branch. Subtree: This is useful when an API or library is to be used as part of an existing project. The subtree will have its own repository separate from the root s repository. The subtree will be responsible for maintaining the API s repository, while the root s repository will be the application code that uses the API. Application Note Overview In this application note, setting up a Git repository and using the basics will be covered. Also, theoretical and practical reasoning will be provided to explain why things are done the way they are presented; often times, in software engineering, conventions are followed to keep the development process robust and more efficient.

Tutorial Set Up This tutorial will assume operating under a UNIX-based system. Using the appropriate package manager on the system (apt-get for Ubuntu Linux or Homebrew for Mac), install git by issuing a command that resembles the following: apt-get install git Initialization This or the following step must take place in order to begin using version control. In order to begin using git, an empty or pre-existing directory must be initialized. For initialization of a pre-existing directory, enter the following command. git init To initialize a directory that has not been created yet, simply enter the name of the directory after the aforementioned command. Cloning The step is optional, because a user may opt to begin development without using another repository as a basis. In the event that an external repository is to be cloned, simply find the URL that specifies where the repository is to be found. In this example, the following repository may be used for learning purposes: https://github.com/faisaltameesh/drone.git Once a URL has been specified, we can now clone it. git clone https://github.com/faisaltameesh/drone.git This, like the previous step, can create a directory that has been initialized to use git, along with including any of the files that are in the most recent version of the repository that the URL points to. The user is now ready to begin editing files and then committing the changes to his/her local repository.

For the following step, it is assumed that the user has made some changes to the file in the repository, namely server.js. Adding the file(s) After the edits, the user is now ready to add the file to the content stage for the next commit. Before a user can commit anything, he/she must add the files to the commit stage. To do so, the following command is implemented. git add server.js If interested, the user may add all the files that have been changed at once by issuing the following command. git add -A The -A flag indicates that entire working directory should be added to the staging area. At this point the user is now ready to commit the changes to the repository. This means that as long as the repository is safely stored, any changes to the code, including the unchanged code that was first cloned, will be accessible by invoking the right commands. Committing the file(s) The user can now commit the file(s) to the repository with a brief message, stating the changes or fixes that took place. git commit m Fixed timeout bug when the server connects over https. This is an example of a commit message. Any message may be used and will be visible whenever the logs are accessed. Viewing the log git log

Reverting to a previous version If the user would like to revert to a previous version without affecting the HEAD pointer points (this is used to manage the repository s history), the following command may be used. git checkout <version_hash> The checkout command can be used in conjunction with the hash specified at the beginning of each commit s log post when viewing the repository s history. At that point, the user may decide to utilize some of the older code, edit some files, etc Afterwards, the same commit process can take place to make sure that the changes are stored. Conclusion Git is a very widely used program by software engineers around the world. While it may seem deceptively simple to use the program (and for basic purposes, it is!), the program is very powerful and is capable of maintaining very large code bases. Git s documentation is plentiful and well-organized. There are also many tutorials available online for those interested in taking their version control skills to the next level.