So#ware(Project. Lecture'4. Wouter'Swierstra. So#ware(project( (Lecture(4 1

Similar documents
Software Project (Lecture 4): Git & Github

Windows. Everywhere else

2 Initialize a git repository on your machine, add a README file, commit and push

GETTING STARTED WITH. Michael Lessard Senior Solutions Architect June 2017

DEAD-SIMPLE VERSION CONTROL FOR YOUR TEAM GIT WITH MATTHEW REIDSMA GRAND VALLEY STATE UNIVERSITY

Version Control with GIT

EECS 470 Lab 4. Version Control System. Friday, 31 st January, 2014

Lecture 6 Remotes. Sign in on the attendance sheet!

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

Git, the magical version control

Git for Newbies. ComMouse Dongyue Studio

CS 390 Software Engineering Lecture 5 More Git

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

Effective Programming Practices for Economists. 7. Version Control, Part II: Git with a Shared Repository

#25. Use Source Control in a Single- Developer Environment

git the SCM system Jan-Simon Möller training.linuxfoundation.org

How to git with proper etiquette

Introduction to Git and Github

Revision Control and GIT

Advanced Operating Systems Control Versioning with GIT. Giuseppe Massari

Code and data management with Git

A Brief Introduction to Git. Sylverie Herbert (based on slides by Hautahi Kingi)

Midterm Next Week. Last year s midterm (which didn t include remotes):

Fundamentals of Git 1

Version Control System - Git. zswu

Contributing to Insoshi with Git and GitHub. Michael Hartl

GIT. CS 490MT/5555, Spring 2017, Yongjie Zheng

GIT DISTRIBUTED IS THE NEW CENTRALISED

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

Introduction to Version Control with Git and GitHub

Git Guide. Meher Krishna Patel. Created on : Octorber, 2017 Last updated : October, More documents are freely available at PythonDSP

Git Tutorial. André Sailer. ILD Technical Meeting April 24, 2017 CERN-EP-LCD. ILD Technical Meeting, Apr 24, 2017 A. Sailer: Git Tutorial 1/36

Version Control Systems

git Version: 2.0b Merge combines trees, and checks out the result Pull does a fetch, then a merge If you only can remember one command:

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

Git tutorial. Katie Osterried C2SM. October 22, 2015

Submitting your Work using GIT

Object Oriented Programming. Week 1 Part 2 Git and egit

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

How To Use Git. Advanced: Tags & Branches. Mary Kate Trost July 8, 2011

The Intro. Aaron Bartell Director of IBM i Innovation. Copyright 2015 Aaron Bartell

Introduction to Git and GitHub for Writers Workbook February 23, 2019 Peter Gruenbaum

CS 390 Software Engineering Lecture 4 - Git

Introduction to Git. Database Systems DataLab, CS, NTHU Spring, 2018

Version Control. Version Control

CSE 391 Lecture 9. Version control with Git

Version Control. Version Control

1/20/13 Git tutorial. Git tutorial. Mike Nolta. file:///users/nolta/github/reveal.js/git.html?print-paper#/ 1/31

GIT Princípy tvorby softvéru, FMFI UK Jana Kostičová,

Introduction to Git For Groups

Effective Software Development and Version Control

GIT FOR SYSTEM ADMINS JUSTIN ELLIOTT PENN STATE UNIVERSITY

Git Introduction CS 400. February 11, 2018

GIT tutorial. David Parsons, Soraya Arias, Thomas Calmant November, Preamble 2

Git Branching. Chapter What a Branch Is

Assumptions. GIT Commands. OS Commands

CS 520: VCS and Git. Intermediate Topics Ben Kushigian

Code Repository. P Blanchfield

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

Visualizing Git Workflows. A visual guide to 539 workflows

Chapter 5. Version Control: Git

Computer Science Design I Version Control with Git

Revision control. INF5750/ Lecture 2 (Part I)

Git: Distributed Version Control

Beyond git add/commit/push

Git for Subversion users

Git. Presenter: Haotao (Eric) Lai Contact:

Git Tutorial. Version: 0.2. Anders Nilsson April 1, 2014

Creating a Patch. Created by Carl Heymann on 2010 Sep 14 1

GUIDE TO MAKE A REAL CONTRIBUTION TO AN OPEN SOURCE PROJECT 1. 1

Software Engineering

Version Control. Software Carpentry Github s Hello World Git For Ages 4 And Up You need source code control now

Git. CSCI 5828: Foundations of Software Engineering Lecture 02a 08/27/2015

Version Control Systems (VCS)

Git for (not-so) dummies

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

MOOSE-Based Application Development on GitLab

Basics of Git GitHub

USING GIT FOR AUTOMATION AND COLLABORATION JUSTIN ELLIOTT - MATT HANSEN PENN STATE UNIVERSITY

! #Running this command from the top directory of your project will add all your changes."! $ git add."

VCS VERSION CONTROL SYSTEMS

Versioning with git. Moritz August Git/Bash/Python-Course for MPE. Moritz August Versioning with Git

1. Git. Robert Snapp

From Commits to Collaboration: A Git Tutorial for Social Scientists

Topics covered. Introduction to Git Git workflows Git key concepts Hands on session Branching models. Git 2

How to be a git. Dominic Mitchell

Tizen/Artik IoT Practice Part 4 Open Source Development

Agenda. Several projects are using GIT Developer(s) Junio Hamano, Linus Torvalds. Qt Stable release (January 31, 2011)

Introduction to GIT. Jordi Blasco 14 Oct 2011

Introduction to Supercomputing

Introduction to Git. Let us list below some of the best known and most widely used version control systems:

Git for Version Control

3 Threadsafe Bounded List Wrapper Library Monitor

Tools for software development:

CS 320 Introduction to Software Engineering Spring February 06, 2017

LAB MANUAL GIT BY PRATIK JAIN. To start with git bash, we need to authenticate ourselves so that for every commit, git can use this information.

FEEG Applied Programming 3 - Version Control and Git II

Version control with Git.

6 Git & Modularization

Praktische Aspekte der Informatik

Transcription:

So#ware(Project Lecture'4 Wouter'Swierstra So#ware(project( (Lecture(4 1

Last%&me Risks So(ware-architecture So#ware(project( (Lecture(4 2

Working(effec,vely(with(git(and(GitHub. So#ware(project( (Lecture(4 3

Collabora've*so,ware*development You$have$two$weeks$to$finish$your$user$stories. And$need$to$give$a$demo$at$the$end. How$can$you$develop$different$stories$in$parallel$without$ breaking$your$working$prototype? So#ware(project( (Lecture(4 4

Version(control So#ware(project( (Lecture(4 5

What%is%git? A#popular,#powerful#distributed#file#version#control#system It#is#free#and#obtainable#from#git;scm.com Originally#developed#to#manage#the#Linux#kernel An#esBmated#27#percent#of#professional#developers#uses#Git# (May#'12). So#ware(project( (Lecture(4 6

Ge#ng&to&grips&with&git Git%is%a%very%powerful%tool%with%many%different%features. The%user%interface%takes%some%ge<ng%used%to... When%used%correctly,%it%can%be%extremely%effecAve. If%you%screw%up,%there%is%usually%a%way%to%undo%your%changes. So#ware(project( (Lecture(4 7

Star%ng(a(new(repo $ git init Initialized empty Git repository in.git/ Add#the#README.md#file#to#the#repository $ git add README.md Commit&the&changes&you&made&to&README.md $ git commit -m "Added README.md" So#ware(project( (Lecture(4 8

Cloning'an'exis,ng'repository To#get#your#hands#on#a#copy#of#an#exis4ng#repository#use: $ git clone git://github.com/wouter-swierstra/softwareproject Note%that%git clone%supports%several%different%protocols,% including%ssh. So#ware(project( (Lecture(4 9

Git$vs$Svn Git$is$a$distributed$version$control$system: a#copy#of#a#repository#can#share#changes#with#any#other#copy. almost#all#commands#operate#on#your#local%copy sharing#changes#with#others#happens#in#two#steps: commi8ng#your#changes#locally pushing#these#changes#to#a#remote#server So#ware(project( (Lecture(4 10

Git$terminology Picture(from(Sco-(Chacon's(Pro$Git. So#ware(project( (Lecture(4 11

Git$status $ git status # On branch master nothing to commit (working directory clean) $ emacs 04-slides.md $ git status # On branch master # Untracked files: # (use "git add <file>..." to include in what will be committed) # # 04-slides.md So#ware(project( (Lecture(4 12

Adding&new&files $ git add 04-slides.md $ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # new file: 04-slides.md So#ware(project( (Lecture(4 13

Staging'modified'files Similarly,)we)can)stage)modified)files)using)git add. $ emacs README.md $ git add README.md # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # new file: 04-slides.md # modified: README.md Git$gives$you$control$over$which$files$to$include$in$a$single$commit. So#ware(project( (Lecture(4 14

Pro$%p:(.gi%gnore(to(minimize(noise Generated(binaries,(documenta1on,(and(so(forth(are(not(under( version(control,(but(keep(showing(up(when(you(run(git status. You$can$have$a$.gitignore$file,$lis0ng$the$files,$directories,$and$ pa6erns$that$you$want$git$to$ignore: $ cat.gitignore *.pdf.ds_store build/ So#ware(project( (Lecture(4 15

Commi%ng(your(changes The$git commit$command$commits$all$the$staged$changes. $ git commit -m "Added 04-slides.md; updated README.md" [master 76d15ab] Added 04-slides.md; updated README.md 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 04-slides.md These%changes%are%recorded%locally%but%not%yet%shared%with%others. So#ware(project( (Lecture(4 16

Not$men(oned git mv"to"rename"files,"without"losing"their"history git rm"to"remove"files"from"the"repository git commit -a"to"record"all"your"changes"to"tracked"files git log"to"get"an"overview"of"recent"changes git reset"to"undo"changes So#ware(project( (Lecture(4 17

Sharing(your(changes All#these#commands#operate#on#your#local#copy#of#the#repository. Nothing(is(shared(with(others(yet. git pull" "pulls"in"changes"from"some"other"repository git push" "pushes"your"changes"to"another"repository These%commands%communicate%with%remote&repositories. So#ware(project( (Lecture(4 18

Basic&usage:&git&push $ git clone git://github.com/wouter-swierstra/softwareproject... $ emacs 04-slides.md $ git commit -am "Updated slides on git"... $ git push Counting objects: 9, done. Delta compression using up to 2 threads. Compressing objects: 100% (5/5), done. Writing objects: 100% (5/5), 3.37 KiB, done. Total 5 (delta 4), reused 0 (delta 0) To git@github.com:wouter-swierstra/softwareproject.git 6040584..9b40f60 master -> master Git's&user&interface&can&be&a&bit&noisy... So#ware(project( (Lecture(4 19

Basic&usage:&git&pull $ git pull remote: Counting objects: 15, done. remote: Compressing objects: 100% (15/15), done. remote: Total 15 (delta 4), reused 1 (delta 0) Unpacking objects: 100% (15/15), done. From github.com:wouter-swierstra/softwareproject 6abc078..08fac51 master -> origin/master Updating 6abc078..08fac51 This%pulls%in%any%new%changes%from%the%remote%repository So#ware(project( (Lecture(4 20

Showing(remote(repositories $ git clone git://github.com/wouter-swierstra/softwareproject... $ git remote -v origin git://github.com/wouter-swierstra/softwareproject (push) origin git://github.com/wouter-swierstra/softwareproject (fetch) You$can$add$new$remote$branches$using git remote add remotename git://github.com/user/repository.git Feel$free$to$choose$your$own$meaningful$remoteName So#ware(project( (Lecture(4 21

Recap This%covers%the%basic%interac/ons%necessary%to%mimic%subversion. Git$makes$it$very%easy$to$work$on$different$versions$of$your$ so4ware. You$can$create$new$branches,$switch$between$branches,$or$merge$ branches$quickly$and$easily. Using&branches&effec.vely&can&dras.cally&improve&collabora.ve& development. So#ware(project( (Lecture(4 22

Branching In#git,#a#branch#is#effec-vely#a#pointer#to#some#repository#state. You$can$add$new$changes$to$any$specific$branch,$which$may$cause$ development$lines$to$diverge. Branches)may)be)merged,)aggrega/ng)changes)made)in)different) development)lines. So#ware(project( (Lecture(4 23

So#ware(project( (Lecture(4 24

Crea%ng(and(switching(branches $ git branch iss53 $ git branch iss53 * master $ git checkout iss53 $ git branch * iss53 master So#ware(project( (Lecture(4 25

So#ware(project( (Lecture(4 26

Diverging(branches If#I'm#in#the#iss53#branch,#I#can#make#changes#without'effec+ng'the' master'branch. $ emacs README.md $ git commit -am "Working on #53" So#ware(project( (Lecture(4 27

So#ware(project( (Lecture(4 28

Even%more%branches $ git checkout master $ git branch hotfix $ git checkout hotfix $ emacs README.md $ git commit -am "Hotfix in README.md" So#ware(project( (Lecture(4 29

How$to$get$the$changes$to$the$hotfix$branch$back$into$master? So#ware(project( (Lecture(4 30

Git$merge $ git checkout master $ git merge hotfix Updating f42c576..3a0874c Fast-forward README.md 2 ++ 1 file changed, 2 insertions(+) So#ware(project( (Lecture(4 31

From%this%point%on,%con.nue%development%in%the%iss53%branch% un.l%it%is%ready%to%be%merged%with%the%master%branch. So#ware(project( (Lecture(4 32

Not$covered Using'git branch -d'to'delete'branches Working'with'remote'branches How'git pull'uses'branches'under'the'hood. More'advanced'branching'commands So#ware(project( (Lecture(4 33

The$real$challenge This%covers%the%very%basic%git%opera0ons. You$can$now$collaborate$on$a$single$codebase. But$collabora+ng$effec$vely$is$not$easy. So#ware(project( (Lecture(4 34

Golden'rules 1. The&master&branch&may&only&contain&code&that&is&tested,& reviewed&and&ready&to&be&released. 2. Only&commit&code&that&compiles,&even&in&experimental&branches. 3. New&user&stories&start&in&a&fresh&branch;&no&such&branch&lives& more&than&three&itera@ons,&before&being&merged. 4. Create&pull&requests&for&every&new&branch.&Only&merge&your& changes&if&everyone&is&happy,&the&code&is&tested&and&reviewed. So#ware(project( (Lecture(4 35

1" "The"master"branch"is"ready"for"release The$master$branch$serves$a$single$purpose: it#represents#the#current#stable#version#of#development If#I#walk#into#your#office#at#any#point#in#3me,#you#should#be#able#to# demo#the#master#branch. The$code$should$be$so$good,$that$you'd$be$happy$to$release$it,$even$ if$it$lacks$func9onality. So#ware(project( (Lecture(4 36

2" "Only"commit"code"that"compiles So#ware(project( (Lecture(4 37

2" "Only"commit"code"that"compiles Breaking)the)build)is)the)cardinal)sin)of)collabora4ve)development. This%blocks%the%en.re%development%team,%un.l%you%fix%the%issue. Compile(and(run(your(regression(tests(before(commi5ng( (don't( make(other(people(clean(up(your(mess. So#ware(project( (Lecture(4 38

3" "New"stories"start"in"a"new"branch The$master$branch$is$the$stable$development$release. Unfinished)features)are)never)developed)on)the)master)branch) directly. Instead,)every)itera.on)starts)with)several)new)branches. Once%new%features%are%tested,%reviewed%and%ready,%they%can%be% merged%back%into%master. So#ware(project( (Lecture(4 39

4" "Create"pull"requests In#principle,#you#can#manage#branches#from#the#commandline. If#you#choose#to#host#your#code#on#GitHub#you#have#some# addi6onal#features#that#can#help#collabora6on: Issue&tracker&(which&can&be&used&for&your&product&backlog) Wiki&for&tracking&documenta<on,&discussions,&or&mee<ng&notes. GUI&for&crea<ng&and&merging&branches Pull&request&=&Code&+&Issue&+&Discussion So#ware(project( (Lecture(4 40

Gitlab'Demo So#ware(project( (Lecture(4 41

Golden'rules 1. The&master&branch&may&only&contain&code&that&is&tested,& reviewed&and&ready&to&be&released. 2. Only&commit&code&that&compiles,&even&in&experimental&branches. 3. New&user&stories&start&in&a&fresh&branch;&no&such&branch&lives& more&than&three&itera@ons,&before&being&merged. 4. Create&pull&requests&for&every&new&branch.&Only&merge&your& changes&if&everyone&is&happy,&the&code&is&tested&and&reviewed. So#ware(project( (Lecture(4 42

Using&GitHub Feel$free$to$use$GitHub,$provided: your&client&is&happy&for&you&to&do&so; a&copy&of&the&repository&is&hosted&on&the&uu&servers&(for& instance,&as&an&addi8onal&remote). There%are%plenty%of%alterna.ves: BitBucket GitLab So#ware(project( (Lecture(4 43

Best%prac*ces Use%git tag%to%tag%the%version%of%the%repository%at%the%end%of% every%sprint%or%upon%delivering%a%milestone. Write%meaningful%commit%messages% %use%"#x"%to%refer%to%issue% numbers%in%the%github%issue%tracker. Check%your%changes%regularly%using%git diff%and%git status Use%git log%to%review%recent%commits So#ware(project( (Lecture(4 44

Further'reading Sco%&Chacon's&Pro/git Atlassian&git&tutorials Pull&request&video&tutorial Most&common&git&screwups So#ware(project( (Lecture(4 45