Revision Control. How can 4. Slides #4 CMPT 276 Dr. B. Fraser. Local Topology Simplified. Git Basics. Revision Control:

Similar documents
Software Development I

1. Which of these Git client commands creates a copy of the repository and a working directory in the client s workspace. (Choose one.

Lab 08. Command Line and Git

Technology Background Development environment, Skeleton and Libraries

Getting the files for the first time...2. Making Changes, Commiting them and Pull Requests:...5. Update your repository from the upstream master...

Version Control System GIT

Visualizing Git Workflows. A visual guide to 539 workflows

CPSC 491. Lecture 19 & 20: Source Code Version Control. VCS = Version Control Software SCM = Source Code Management

Version Control Systems. Copyright 2017 by Robert M. Dondero, Ph.D. Princeton University

Agenda. - Final Project Info. - All things Git. - Make sure to come to lab for Python next week

Lab 01 How to Survive & Introduction to Git. Web Programming DataLab, CS, NTHU

Git for Subversion users

What is version control? (discuss) Who has used version control? Favorite VCS? Uses of version control (read)

The Old World. Have you ever had to collaborate on a project by

Configuration Management

b. Developing multiple versions of a software project in parallel

Version Control Systems (Part 1)

CS314 Software Engineering Configuration Management

GETTING TO KNOW GIT: PART II JUSTIN ELLIOTT PENN STATE UNIVERSITY

Github/Git Primer. Tyler Hague

SECTION 2: HW3 Setup.

CESSDA Expert Seminar 13 & 14 September 2016 Prague, Czech Republic

Software Project (Lecture 4): Git & Github

Lecture 2: Data in Linguistics, Git/GitHub, Jupyter Notebook. LING 1340/2340: Data Science for Linguists Na-Rae Han

Distributed Version Control

KTH Royal Institute of Technology SEMINAR 2-29 March Simone Stefani -


Version control CSE 403

Version Control Systems: Overview

Git Workflows. Sylvain Bouveret, Grégory Mounié, Matthieu Moy

Lab Objective. Lab Assignment. Downloads and Installation

2/9/2013 LAB OUTLINE INTRODUCTION TO VCS WHY VERSION CONTROL SYSTEM(VCS)? II SENG 371 SOFTWARE EVOLUTION VERSION CONTROL SYSTEMS

A quick (and maybe practical) guide to Git and version control. By Jay Johnson

CS 320 Introduction to Software Engineering Spring February 06, 2017

A BASIC UNDERSTANDING OF VERSION CONTROL

Software Tools Subversion

Version Control Systems

Intro to Github. Jessica Young

Use git rm to remove files from workspace

Tools for software development:

Git. Christoph Matthies Software Engineering II WS 2018/19. Enterprise Platform and Integration Concepts group

About SJTUG. SJTU *nix User Group SJTU Joyful Techie User Group

CSCI 2132: Software Development. Norbert Zeh. Faculty of Computer Science Dalhousie University. Subversion (and Git) Winter 2019

Version Control. Second level Third level Fourth level Fifth level. - Software Development Project. January 17, 2018

Review Version Control Concepts

CSE 331 Software Design & Implementation

Overview. 1. Install git and create a Github account 2. What is git? 3. How does git work? 4. What is GitHub? 5. Quick example using git and GitHub

Object Oriented Programming. Week 1 Part 2 Git and egit

SECTION 2: Loop Reasoning & HW3 Setup

CS 390 Software Engineering Lecture 3 Configuration Management

Software configuration management

SECTION 2: Loop Reasoning & HW3 Setup

Working in Teams CS 520 Theory and Practice of Software Engineering Fall 2018

Laboratorio di Programmazione. Prof. Marco Bertini

git commit --amend git rebase <base> git reflog git checkout -b Create and check out a new branch named <branch>. Drop the -b

Git AN INTRODUCTION. Introduction to Git as a version control system: concepts, main features and practical aspects.

Tizen/Artik IoT Practice Part 4 Open Source Development

What is git? Distributed Version Control System (VCS); Created by Linus Torvalds, to help with Linux development;

Version Control. Second level Third level Fourth level Fifth level. - Software Development Project. January 11, 2017

GIT VERSION CONTROL TUTORIAL. William Wu 2014 October 7

Version control CSE 403

Windows. Everywhere else

FEEG Applied Programming 3 - Version Control and Git II

Assignment 1: Port & Starboard

Technology Background Development environment, Skeleton and Libraries

Version Control System - Git. zswu

Git for Newbies. ComMouse Dongyue Studio

G E T T I N G S TA R T E D W I T H G I T

SECTION 1: CODE REASONING + VERSION CONTROL

CS 390 Software Engineering Lecture 5 More Git

SECTION 1: CODE REASONING + VERSION CONTROL

Git and GitHub. Dan Wysocki. February 12, Dan Wysocki Git and GitHub February 12, / 48

699DR git/github Tutorial

Version Control with Git ME 461 Fall 2018

Effective Software Development and Version Control

Versioning. Terms. Configuration item (CI) Version Configuration Management aggregate Configuration Baseline

git and the virtue of version control ECE /2/2015

Git. Presenter: Haotao (Eric) Lai Contact:

The Rock branching strategy is based on the Git Branching Model documented by Vincent Driessen.

Getting started with GitHub

Using Git and GitLab: Your first steps. Maurício

Software Revision Control for MASS. Git Basics, Best Practices

Beyond git add/commit/push

Lecture 6 Remotes. Sign in on the attendance sheet!

Version (Source Code) Control SWEN-250

Git, the magical version control


Version Control Systems (VCS)

Advanced Configuration Management with Config Split et al. Fabian Bircher

Git(Lab) Tutorial and Hands-On

Version control CSE 403

CSE 332: Data Structures and Parallelism Winter 2019 Setting Up Your CSE 332 Environment

FAQ Q: Where/in which branch do I create new code/modify existing code? A: Q: How do I commit new changes? A:

A L A TEX-oriented intro to Git

Git AN INTRODUCTION. Introduction to Git as a version control system: concepts, main features and practical aspects.

Revision Control. An Introduction Using Git 1/15

Software Development. Using GIT. Pr. Olivier Gruber. Laboratoire d'informatique de Grenoble Université de Grenoble-Alpes

GIT FOR SYSTEM ADMINS JUSTIN ELLIOTT PENN STATE UNIVERSITY

AIS Grid School 2015

CS 520: VCS and Git. Intermediate Topics Ben Kushigian

Transcription:

How can 4 (or 4000) developers work on a product at once? Revision Control Revision Control Revision Control: Also called version control, source control, software configuration management. Motivation: Need to coordinate changes made by multiple developers. Need a reliable system to ensure changes are More Info: https://git-scm.com/book/en/v2/getting-started-about-version-control Slides #4 CMPT 276 Dr. B. Fraser 18-01-04 1 18-01-04 2 Local Topology Simplified Local Machine has a Git Basics 18-01-04 3 Local Repository Working Directory Local Computer.Ṫhe latest code in the repo can be checked-out into the working directory. Head: the latest version of the code..ċhanges to files in the working directory are committed to the local repo 18-01-04 4

Remote Topology Simplified Distributed Local Repository Working Directory Local Computer Remote Repository Remote Server Remote Server has a Git Repo It is the server being accessed by multiple developers Local repo syncs up with remote Distributed Version Control Git has each local repo is a full and complete repo. Can work off-line (on a plane) and still commit to the local repo. Later sync up with the remote repo. Git Servers Often the remote repo is a dedicated Git server such as GitHub or GitLab. These systems add extra team collaboration / discussion tools (more later). 18-01-04 5 18-01-04 6 Work Flow 1: Setup Associate your local repo to a remote repo by either: Create a repo in GitLab (gitlab.cs.sfu.ca) and push some existing code to it; or an existing repo to your local PC. Work Flow 2: Changes Do some work in working directory create new files, change files, delete files, etc. Stages the changes as being ready to commit. Also used for adding files to Git (tracking them) Commit all staged changes to local repo. Sometimes termed Check-in Transfer locally committed changes to remote repo. View the state of local file changes 18-01-04 7 18-01-04 8

Work Flow 3: Other s Changes Git Tools Other team members will push some changes to the repo which you then want May be new / changed / deleted files Get changes from remote repo and apply them to local repo and working directory (move to head). If there are any conflicting changes, may need to do a merge (more later). At any time, can view the changes people have made. 18-01-04 9 Command Line Git is very often accessed via its command-line tools Git commands look like: git commit git clone git@csil-git1.cs.surrey.sfu.ca:myteam/daproject.git GUI Integrated Tools but low-level understanding is sometimes required! Can be inside IDE: Android Studio Can be integrated into file system: TortoiseGit Lecture: command line for understanding the tool; Assignments: IDE for convenience (likely). 18-01-04 10 Command-line Demo Git Command Demo [create repo on gitlab.cs.sfu.ca] git clone <git@csil-git1.cs> [now edit file hello.txt] git status git add hello.txt git commit git push git log git pull Git Details 18-01-04 11 18-01-04 12

Basic Git Sequence for Editing Code Merge Conflict Demo 0. Have a working directory with no changes 1. will "fast-forward" without any conflicting changes 2. cannot pull with some uncommitted changes 3. 4. automatically merges files without conflicting changes 5. manually merge conflicts when required cannot push if others have pushed code: current branch is behind master, unable to fast-forward 18-01-04 13 Show demo of conflicting changes being made by two team members at once Pulling with uncommitted conflicts fails Pushing before merging fails Commit my changes Pull to trigger merge When merge done then add/commit/push Android Studio has VCS --> Update Project Which works with uncommitted conflicts It automatically stash changes to get around having to do extra commit 18-01-04 14.gitignore.gitignore File Lists file types to exclude from Git: Example: Exclude.bak, build products, some IDE files Tag Tag the project s contents at a specific commit Can later check-out that tag to return to the project state at that time Example Uses Track project code going into a release: V1.51 Commit Messages A good commit message is required! Line 1: (<50 words) Capitalize your statement Use imperative: "Fix bug." vs "fixed" or "fixes" Line 2: Line 3+: ; wrap your text ~70 characters Example: Make game state persist between launches and rotation. Use SharedPreferences to store Game's state. Serialize using Gson library and Bundle for rotation. 276 Pair Programming If pair programming, add pair s user ID: [pair: bfraser] 18-01-04 15 18-01-04 16

Reverting Changes Delete, Rename git checkout to revert files Overwrite file in working directory with one from local repo. Revert with Caution Will lose all uncommitted changes in the file. Normally Git does not let you lose changes. If in doubt, grab a backup copy (ZIP your folder) then revert. Just make sure you don t commit the backup! Delete Delete file normally via the OS/IDE, Git records it's now deleted. Will be deleted on everyone else's system when they pull your changes. Rename Rename file normally via the OS/IDE, then "add" it to Git Git tracks files by their content, not by their name. 18-01-04 17 18-01-04 18 Merge vs Lock 2 Competing ways revision control protects files: Revision Control Generalities Checkout-Edit-Merge Merge support allows concurrent access to a file so multiple developers can work on same code at once But can lead to. Lock-Edit-Unlock Locking prevents merge conflicts by "I can't make any changes until Bob finish!" Adds pressure to make changes quickly "I NEED THAT FILE! CHECK IN NOW!" 18-01-04 19 18-01-04 20

Revision Control Features Team Work Atomic operations Minimum requirement to committing code: Change is applied all at once: no other changes applied while you're checking in. Tag Mark certain versions of certain files as a group. Ex: "Files for Version 1.0 of product". Able to easily of the files later to fix bugs etc. "Get all files exactly as the were in Version 1.0 (three year ago)". 18-01-04 21 When you check in, the full system must compile and run. Only under exceptional circumstances should you ever check in something which breaks the build. 18-01-04 22 Committing Frequency Coding with Source Control Expected Commit Frequency Commit little changes to local repo very often Once some work is more stable, push all the changes at once to remote repo // Removed Jan 2002 for V1.01 // cout << "Dave; I wouldn't do that, Dave.\n"; Put meaningful comments into checkins! #if 0 // Unneeded, but left 'cuz someone may want it. #endif 18-01-04 23 // Written by Dr. Evil 18-01-04 24

Summary Revision control a critical tool for development. Git is a distributed revision control system. Operations: clone, add, commit, push, pull Git Details Merge conflicting changes as needed..gitignore, revert (git s checkout) Basic Features Atomic operations, tags/label Rules to Code By Commit often, don t break the build 18-01-04 25