Version Control Systems

Slides:



Advertisements
Similar presentations
Introduction To GIT Rob Di Marco Philly Linux Users Group July 14, 2008.
Advertisements

Simple Git Steve Pieper. Topics Git considerations and Slicer Git as if it were svn Git the way it is meant to be.
Software Configuration Management Donna Albino LIS489, December 3, 2014.
om om GIT - Tips & Tricks / git.dvcs git-tips.com
Version Control with git. Version Control Version control is a system that records changes to a file or set of files over time so that you can recall.
Git
1 CSE 390 “Lecture 11” Version control with Git slides created by Ruth Anderson, images from
Introduction to Git and Github Joshua imtraum.com.
Git: Part 1 Overview & Object Model These slides were largely cut-and-pasted from tutorial/, with some additions.
Git for Version Control These slides are heavily based on slides created by Ruth Anderson for CSE 390a. Thanks, Ruth! images taken from
Fundamentals of Git By Zachary Ling 29 th, Aug,
Version control Using Git 1Version control, using Git.
Version Control with Subversion. What is Version Control Good For? Maintaining project/file history - so you don’t have to worry about it Managing collaboration.
Introduction to Version Control with SVN & Git CSC/ECE 517, Fall 2012 Titus Barik & Ed Gehringer, with help from Gaurav.
علیرضا فراهانی استاد درس: جعفری نژاد مهر Version Control ▪Version control is a system that records changes to a file or set of files over time so.
With Mercurial and Progress.   Introduction  What is version control ?  Why use version control ?  Centralised vs. Distributed  Why Mercurial ?
Git – versioning and managing your software L. Grewe.
Version control Using Git Version control, using Git1.
Version Control Systems academy.zariba.com 1. Lecture Content 1.What is Software Configuration Management? 2.Version Control Systems (VCS) 3.Basic Git.
…using Git/Tortoise Git
Git workflow and basic commands By: Anuj Sharma. Why git? Git is a distributed revision control system with an emphasis on speed, data integrity, and.
SWEN 302: AGILE METHODS Roma Klapaukh & Alex Potanin.
Team 708 – Hardwired Fusion Created by Nam Tran 2014.
Introduction to Version Control with Git CSC/ECE 517, Fall 2014 A joint project of the CSC/ECE 517 staff, including Titus Barik, Gaurav Tungatkar, Govind.
1 GIT NOUN \’GIT\ A DISTRIBUTED REVISION CONTROL AND SOURCE CODE MANAGEMENT (SCM) SYSTEM WITH AN EMPHASIS ON SPEED. INITIALLY DESIGNED AND DEVELOPED BY.
GIT.
Intro to Git presented by Brian K. Vagnini Hosted by.
Introduction to Git Yonglei Tao GVSU. Version Control Systems  Also known as Source Code Management systems  Increase your productivity by allowing.
It’s not just an insult from Harry Potter!. What is Git? Distributed Version Control System (DVCS) – Compared to a Centralized Version Control System.
Introduction to Git - Chirag Dani. Objectives Basics of Git Understanding different “Mindset of Git” Demo - Git with Visual Studio.
Git How to 1. Why Git To resolve problems in lab exams (accidental deletions) Use existing Libraries with ease (Statistics and Computer) Prepare undergraduates.
1 Ivan Marsic Rutgers University LECTURE 2: Software Configuration Management.
Git A distributed version control system Powerpoint credited to University of PA And modified by Pepper 28-Jun-16.
Getting Started with Git Presented by Jim Taylor Rooty Hollow, Owner Verizon Wireless, Senior Programmer/Analyst Git User for 6 years.
Jun-Ru Chang Introduction GIT Jun-Ru Chang
GitHub A web-based Git repository hosting service.
GIT Version control. Version Control Sharing code via a centralized DB Also provides for Backtracking (going back to a previous version of code), Branching.
Git Girish Git VCS that I have used ClearCase, cvs, svn Happy p4 user.
SCMs – What, Why and How? ● Sawyer X ● Sysadmin / Perl Ninja ● User of Subversion, Git ● Your host for this evening ● Oh, and... ● SCMs = Source Code Management.
Backing up a machine with git
KIT – University of the State of Baden-Wuerttemberg and National Research Center of the Helmholtz Association STEINBUCH CENTRE FOR COMPUTING - SCC
Dr. Tanusri Bhattacharya
Basics of GIT for developers and system administrators
CS5220 Advanced Topics in Web Programming Version Control with Git
Primož Gabrijelčič Git for Programmers Primož Gabrijelčič
Git and GitHub primer.
11 Version control (part 2)
CReSIS Git Tutorial.
LECTURE 2: Software Configuration Management
Git Practice walkthrough.
Version control, using Git
CS5220 Advanced Topics in Web Programming Version Control with Git
Version Control System using Git
Development and Deployment
Storing, Sending, and Tracking Files Recitation 2
Concurrent Version Control
Version Control System
Distributed Version Control with git
Akshay Narayan git up to speed with RCS Akshay Narayan
Version Control with git
LECTURE 3: Software Configuration Management
Git CS Fall 2018.
Version Control System - Git
Version control with Git
Patrick Cozzi University of Pennsylvania CIS Fall 2012
Version Control with Git and GitHub
Git Introduction.
Git GitHub.
Introduction to The Git Version Control System
Advanced Git for Beginners
Presentation transcript:

Version Control Systems Introduction to GIT Version Control Systems

Version Control Version control (a.k.a. revision control) is a system that records changes to a file or set of files over time so that you can retrieve specific versions later and manage a collection of files for use by a group project Version Control can be: Local Centralized Distributed

Local A Local VCS uses a simple database to keep all the changes to files under revision control.

Centralized Version Control Centralized Version Control Systems have a single server that contains all the versioned files, and a number of clients that check out files from that central place.

Distributed Version Control In a distributed VCS, clients don’t just check out the latest snapshot of the files: they fully mirror the repository.

Distributed Version Control GIT is a distributed version control system A master authoritative server is only used if desired by a project Every checked out copy is a repository Version control can be used even when detached from server Backup of a repository is trivial Other distributed systems include Mercurial BitKeeper Darcs Bazaar

Git Advantages Resilience Speed Space Simplicity No one repository has more data than any other Speed Very fast operations compared to most VCS Space Compression can be done across repository not just per file Minimizes local size as well as push/pull data transfers Simplicity Object model is very simple Large user base with robust tools Open source, free

Some GIT Disadvantages Definite learning curve, especially for those used to centralized systems must pay attention to follow recommended procedures when several people are working on a project Documentation mostly through man pages and web wikis Windows support is not as well developed as for Linux/Unix

Git Workflow

Git Architecture Workspace (working directory) Index Object Database A regular directory that contains a git repository (.git subdirectory) Index Stores information about current working directory and changes made to it Object Database Blobs (files) Stored in .git/objects Each indexed by unique hash All files are stored as blobs Commits One object is stored for every commit Contains hash of parent, name of author, time of commit, and hash of the current tree Tags

Some Commands Getting a Repository Commits Getting information git init git clone Commits git add git commit Getting information git help git status git diff git log git show

Our First Git Repository mkdir gitRepo1 cd gitRepo1 git init Creates an initial repository in the .git subdirectory echo "Hello World" >hello.txt git status shows which files have been modified in working directory and/or index since the last commit

Our First Git Repository (in directory gitRepo1) git add . adds all changed files in the current working directory to the index of the current repository makes the index reflect the working tree used to stage changes for a commit (decide which files should be committed prior to a commit) git commit -m 'Check in #1' Stores the current contents of the index in a new commit along with a log message describing the changes A commit operation is what actually updates the repository

Working With Git echo "I love Git" >>hello.txt git diff Shows what changes we have made compares working tree with index by default git status Shows list of modified files git add hello.txt No changes shown now, as working tree and index are the same git diff HEAD Compares working tree with latest commit (HEAD) git commit -m 'Check in #2'

Viewing History git log git show <OBJECT> git reflog Shows a log of commits, with most recent first Note the hash code, which identifies each commit git show <OBJECT> OBJECT can be a full or shortened hash code git reflog to show all updates that have occurred to the current branch

Undoing What is Done git checkout <branch> Used to checkout a specific version/branch of the tree git revert <commit> Makes a new commit that reverses the effect of an earlier commit Example: git revert HEAD Does not delete the commit object, just applies a patch Reverts can themselves be reverted! git reset Moves the working tree back to a certain specified version Use the --force if you really want to ignore working changes Ordinary git commands do not delete commit objects It is very hard to shoot yourself in the foot!

Git and Tagging Tags are just human readable shortcuts for hashes A tag can be created to refer to any commit git tag –a <tag-name> [<commit>] Creates a tag to refer to the given commit (HEAD by default) git tag –l List all tags git show-ref --tags Show all tags with their commit hashes

Branching Multiple branches allow you to work on a new part of a system without disrupting the stable version of the system Git branching is lightweight Most of the code does not need to be copied Tools for helping merge branches and changes easily You are ALWAYS working on a branch By default, you are working on a branch named “master” Branches can be local or remote Key commands git branch Lists all local branches available in the current repository The current branch is highlighted with *

Using Branches git checkout -b newbranch git branch A branch named newbranch is created and checked out The new branch will start with the same content as the current branch Make sure you have committed changes in the current branch before switching to a new branch git branch Check which branch is currently checked out We can now make changes in one branch and then propagate changes using git merge git cherry-pick

Branching Example Simple branching: start a new branch (mywork) to develop an experimental feature or work on fixing a bug o--o--o <-- master \ a--b--c <-- mywork

Branching Example More work done on master branch o--o--O--o--o--o <-- master \ a--b--c <-- mywork

Merging Example Could merge changes from master into the current branch (mywork) git merge master o--o--O--o--o--o <-- master \ a--b--c--m<-- mywork

Merging Example o--o--O--o--o--m <-- master \ a--b--c <-- mywork When an experimental branch has been adequately tested, we can merge it into the master branch git checkout master git merge mywork o--o--O--o--o--m <-- master \ a--b--c <-- mywork

Cleaning Up git fsck git gc Checks object database to make sure all is sane Can show information about dangling objects git gc Cleans up repository and compress files When used with --prune, cleans out dangling blobs Can speed up larger repositories, but not often necessary for small projects

Using a Remote Repository Replicate a remote repository git clone Get changes with git fetch git pull (fetches and merges) Propagate changes with git push Protocols Local filesystem SSH Rsync HTTP Git protocol

Cloning our Repository git clone first-git-repo Now have a full git repository to work with Changes are pushed back with git push Pushing changes WILL NOT change working copy on the repository being worked on Branches can be based off of remote branches git branch --track new-branch remote/branch Remote configuration information stored in .git/config Can have multiple remote backends!

Git for Software Versioning Create convention to define default server Developers clone from central server Lots of tools for transmitting patches between developers Being used for Linux (obviously) Ruby On Rails Check out http://github.com for a variety of hosted projects

Git for Backups Example: A directory needs regular backups Could use Linux rsync, but unwieldy in size Create Git repository for appropriate directory regular local commits regular push to backup location Can store/retrieve simple revision history

Git for Configuration Management Example: Apache configurations Multiple environments (dev/test/production) Each environment is a separate branch Tags are defined for each release version Minor differences between environments IP Address Log levels Want to effectively move changes across environments

Further Resources http://git-scm.com/ Git project home page http://www.kernel.org/pub/software/scm/git/docs/ user-manual.html http://jonas.iki.fi/git_guides/HTML/git_guide/

Key Git Files/Directories ~/.gitconfig .git In top level directory of repository Contains all objects, commits, configuration, for project .git/config has project specific configurations .gitignore Stored in directory for ignoring

Some Git Coolness NetBeans provides interface to use projects with Git gitk Linux GUI to review changes bash/zsh completion git instaweb Used for starting HTTP process for browing project

Git and Other VCS Integrations with Subversion CVS Darcs Many others Example of integration with Subversion Use git-svn to fetch and commit push Note initial fetch may take a long time as each commit is downloaded individually! Use git commands for everything Branches integrated with tags and branches

Git and Patch files git diff HEAD^^ git diff HEAD~10..HEAD~2 Show what has changed in last two commits git diff HEAD~10..HEAD~2 Show what changed between 10 commits ago and two commits ago git format-patch HEAD^^..HEAD Will create individual patch files per commit git apply to apply patches git am to apply patches from an mbox Can also compare Between specific objects To branches/tags