0% found this document useful (0 votes)
39 views29 pages

Week4 M

This document discusses change management in software development and version control tools. It describes the types of changes that occur in software like bug fixes and enhancements. It then covers features needed to manage changes like timestamps and backups. Next, it discusses disadvantages of early version control methods like diff and patch. Finally, it introduces version control tools like Git and Subversion that can track changes, revisions, authors and allow reverting files. It compares centralized and distributed version control systems and provides terminology for concepts like repositories, commits, branches and workflows.

Uploaded by

leish
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views29 pages

Week4 M

This document discusses change management in software development and version control tools. It describes the types of changes that occur in software like bug fixes and enhancements. It then covers features needed to manage changes like timestamps and backups. Next, it discusses disadvantages of early version control methods like diff and patch. Finally, it introduces version control tools like Git and Subversion that can track changes, revisions, authors and allow reverting files. It compares centralized and distributed version control systems and provides terminology for concepts like repositories, commits, branches and workflows.

Uploaded by

leish
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 29

Change Management

Lab 4

What Changes Are We Managing?


Software
Planned software development
team members constantly add new code

(Un)expected problems
bug fixes

Enhancements
Make code more efficient (memory, execution time)

The only constant in software development is change

Features Required to Manage Change

Backups
Timestamps
Who made the change?
Where was the change made?
A way to communicate changes with team

How to achieve that


Big project with multiple files
Bug fix required changing multiple files
Bug fix didnt work
How to find the problem

Figure out which parts changed (diff)


Communicate changes with team (patch)

Disadvantages of diff & patch


Diff requires keeping a copy of old file before changes
Work with only 2 versions of a file (old & new)
Projects will likely be updated more than once
store versions of the file to see how it evolved over time
index.html
index-2009-04-08.html
index-2009-06-06.html
index-2009-08-10.html
index-2009-11-04.html
index-2010-01-23.html
index-2010-09-21.html

Numbering scheme becomes more complicated if we


need to store two versions for the same date

Disadvantages of diff & patch


Need to save a full copy of the file even if only a
single line changed
Two people may edit the same file on the same
date
To see changes between X and Y, versions X and Y
need to be sent

Changes to one file might affect other files (.h &


.c)
Need to make sure those versions are stored together
as a group

How Do We Manage Changes?


Version Control Tools: track and control changes to files

What changes were made?


When were changes made?
Who made the changes?
Revert back to a previous version

Popular Tools: Subversion, Git, Bazaar

Centralized vs. Distributed VCS


Single central copy of the
project history on a
server

Each developer gets the


full history of a project on
their own hard drive

Changes are uploaded to


the server

Developers can
communicate changes
between each other
without going through a
central server

Other programmers can


get changes from the
server
Examples: SVN, CVS

Examples: Git, Mercurial,


Bazaar, Bitkeeper

Centralized

Distributed

Centralized: Pros and Cons


The full project history is only stored in one central place.
Pros
Everyone can see changes
at the same time
Simple to design

Cons
Single point of failure (no
backups!)

Distributed: Pros and Cons


The entire project history is downloaded to the hard drive
Pros
Commit changes/revert to
an old version while offline
Commands run extremely
fast because tool accesses
the hard drive and not a
remote server
Share changes with a few
people before showing
changes to everyone

Cons
long time to download
A lot of disk space to store
all versions

Version Control Terminology


Repository
A database usually stored on a server that
contains:
A set of files and directories
The full history and different versions of a project

Working Copy
A local copy of files from a repository at a specific
time or revision

More Terminology
Check-Out
The act of creating a local working copy from the
repository

Commit
The action of writing the changes made in the
working copy back to the repository

Big Picture

checkout

Git Workflow

Git Architecture

git has 4 object types to implement source control:


Blobs
Like filesystem files (sequence of bytes)
Stored in .git/objects
Trees
Like filesystem directories
Can include other git trees or blobs
Commits
Created when git commit is executed
Points to the top-level tree of the project at the point of commit
Contains name of committer, time of commit and hash of current tree
Tags
Give names to commit objects for convenience
Include tag name, the commit referred to, tag message, tagger info

Objects uniquely identified with hashes

Git Object Store w/o Commits

Git Object Store w/ First Commit

Git Object Store w/ First Commit

Git Architecture contd


head
A reference to a commit object
A repository can contain any number of heads

HEAD
Refers exclusively to the currently active (checked out) head

Branch
Refers to a head and the entire history of ancestor commits
preceding that head

Master
The default head name that git creates when the repo is first
created. It refers to the default branch created in the repository.

Some git Commands


Getting a Repository
git init //creates new repository
git clone //gets a copy of an existing repository

Commits
git add //adds files to the index
git commit // changes are added to the repo

Getting information
git help, git status, git log, git show, git diff

First Git Repository


$ mkdir gitroot
$ cd gitroot
$ git init
creates an empty git repo (.git directory with all necessary
subdirectories)

$ echo Hello World > hello.txt


$ git add .
Adds content to the index
Must be run prior to a commit

$ git commit m Check in number one

Working With Git


$ echo I love Git >> hello.txt
$ git status
Shows list of modified files
hello.txt

$ git diff
Shows changes we made compared to index

$ git add hello.txt


$ git diff
No changes shown as diff compares to the index

$ git diff HEAD


Now we can see changes in working version

$git commit m Second commit

Undoing What Is Done


git checkout
Used to checkout a specific version/branch of the tree

git revert
Reverts a commit
Does not delete the commit object, just applies a
patch
Reverts can themselves be reverted!

Git never deletes a commit object


It is very hard to lose data

Overview
clone

Lab 4
GNU Diffutils uses " ` " in diagnostics
Example: diff .
Output: diff: cannot compare `-' to a directory
Want to use apostrophes only

Diffutils maintainers have a patch for this


problem called maint: quote 'like this' or "like
this", not `like this'
Problem: You are using Diffutils version 3.0,
and the patch is for a newer version

Backporting
Taking a certain software modification (patch)
and applying it to an older version of the
software than it was initially created for.

Steps
1) Installing Git
Ubuntu: $ sudo apt-get install git
SEASnet
Git is installed in /usr/local/cs/bin
Add it to PATH variable or use whole path

2) Make a directory gitroot and get a copy of the


Diffutils Git repository
$ mkdir gitroot
$ cd gitroot
$ git clone git://git.savannah.gnu.org/diffutils.git

3) Follow steps in lab and use man git to find commands

You might also like