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

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

Beyond git add/commit/push

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

CS 390 Software Engineering Lecture 5 More Git

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

Git for Subversion users

Git. A Distributed Version Control System. Carlos García Campos

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. zswu

API RI. Application Programming Interface Reference Implementation. Policies and Procedures Discussion

Version Control: Gitting Started

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

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

a handful of Git workflows for the agilist steven harman twitter: stevenharman

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

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

Git, the magical version control

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

Git. Presenter: Haotao (Eric) Lai Contact:

CS 520: VCS and Git. Intermediate Topics Ben Kushigian

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

Git Basi, workflow e concetti avanzati (pt2)

Software Project (Lecture 4): Git & Github

AIS Grid School 2015

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

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

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:

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

Using GitHub and SourceTree to work with DITA TC repositories

Version control CSE 403

Git. all meaningful operations can be expressed in terms of the rebase command. -Linus Torvalds, 2015

E, F. deleteall command, 352 directory structure, 350 export_data method, 353 inline_data method, 353 print_export method, 351 target directory, 351

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

Ingegneria del Software Corso di Laurea in Informatica per il Management (D)VCS. Davide Rossi Dipartimento di Informatica Università di Bologna

Welcome! Virtual tutorial will start at 15:00 GMT. Please leave feedback afterwards at:

Visualizing Git Workflows. A visual guide to 539 workflows

git-flow Documentation

Github/Git Primer. Tyler Hague

Why? Clean Model Branches Local reflog Flows Doc Ex. Advanced use of Git. Matthieu Moy

Version control CSE 403

Why? Clean Model Branches Local reflog Flows Doc Ex. Advanced use of Git. Matthieu Moy

Online Remote Repositories

Distributed Version Control (with Git)

Git for Newbies. ComMouse Dongyue Studio

Windows. Everywhere else

Git. Ľubomír Prda. IT4Innovations.

Introduction, Instructions and Conventions

CSC 2700: Scientific Computing

GIT FOR SYSTEM ADMINS JUSTIN ELLIOTT PENN STATE UNIVERSITY

Introduction to distributed version control with git

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

Software configuration management

Version Control with Git

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

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

Git! Fundamentals. IT Pro Roundtable! June 17, 2014!! Justin Elliott! ITS / TLT! Classroom and Lab Computing!! Michael Potter!

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

Mike McQuaid INCLUDES 66 TECHNIQUES. Foreword by Scott Chacon MANNING

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

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

Software Development I

Gitting things done. Hands-on introduction to git niceties. Jan Urbański Ducksboard

Using Git For Development. Shantanu Pavgi, UAB IT Research Computing

Index. Alias syntax, 31 Author and commit attributes, 334

INET

Belle II - Git migration

Version control with Git.

Improving Your Life With Git

Git Introduction CS 400. February 11, 2018

FPLLL. Contributing. Martin R. Albrecht 2017/07/06

Git(Lab) Tutorial and Hands-On

Git for Version Control

MOOSE-Based Application Development on GitLab

Git: Distributed Version Control

Version Control. Version Control

Revision Control and GIT

Tools for software development:

Source Code Management wih git

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

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

Fundamentals of Git 1

Laboratorio di Programmazione. Prof. Marco Bertini

Version control CSE 403

February 2 nd Jean Parpaillon

A L A TEX-oriented intro to Git

Intro to Github. Jessica Young

Git. SSE2034: System Software Experiment 3, Fall 2018, Jinkyu Jeong

CS 390 Software Engineering Lecture 3 Configuration Management

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

Git Like You Mean it. Alan Ott SCaLE 16x March 8-11, 2018

Contribute To Linux Mainline

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

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

Version Control with Git

Best Practices. Joaquim Rocha IT-DSS-TD

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

How to git with proper etiquette

Tips on how to set up a GitHub account:

Being More Productive with Git


Transcription:

s Sylvain Bouveret, Grégory Mounié, Matthieu Moy 2017 [first].[last]@imag.fr http://recherche.noiraudes.net/resources/git/git-workflow-slides.pdf 1 / 16

Goals of the presentation Global history: multiple workflow Global history: branching, rebasing, stashing 2 / 16

Workflows

Branches Branching exists in most VCS. The goal is to keep track separately of the various parallel works done on an on-going software development. This is Git killing feature: Git branch management (and merge) is lightweight and efficient. Thus it is quite easy to split the work among the developpers and still let them work easily together toward the common goal. But it is not a magic bullet: the splitting of the work should be handle with care. 3 / 16

Example of bad splitting: per branches Pro simple to define and set-up Cons missing information: to find something, you need to know who did it redundant information: committer and branch name are strongly related confusing and error prone code sharing, blending new feature development and bug correction s use old version of common code As it does not enforce convergence of code the multiple incompatible development are increasingly difficult to merge 4 / 16

Better splitting: per topic branches master branch contain release versions develop branch contain ongoing development release branch to prepare new release in master hotfix branch for bug correction of release version feature branch to develop new features [Vincent Driessen, http://nvie.com/posts/ a-successful-git-branching-model/] 5 / 16

Code sharing models Distributed VCS such as Git are... distributed. The code is thus modified at several places at the same time. There are many different ways to share the code modifications between repositories. 6 / 16

Code sharing: centralized workflow central Similar to SVN way of life, just fully operational with branches, merge and off-line work. Quite good for small teams. 7 / 16

Code sharing: centralized workflow central Similar to SVN way of life, just fully operational with branches, merge and off-line work. Quite good for small teams. Additional transfers using git are easy and safe! The tricky part The most important point is to use git for transfer patches. Any transfer outside git can not be taken into account in futur merge. 7 / 16

Centralized workflow 1 do { 2 while ( nothing_ interesting ()) 3 work (); 4 while ( uncommited_ changes ()) { 5 while (! happy ) { // git diff -- staged? 6 while (! enough ) git add -p; 7 while ( too_ much ) git reset -p; 8 } 9 git commit ; // no -a 10 if ( nothing_ interesting ()) 11 git stash ; 12 } 13 while (! happy ) 14 git rebase -i; 15 } while (! done ); 16 git push ; // send code to central 8 / 16

Code sharing: Github workflow blessed integration pull public private Released and official branches are stored in the blessed. Contributors forks and works privately Contributors publish their work and ask for merge Integrators merges then publish the contributions 9 / 16

Code sharing: Github workflow blessed integration public push private Released and official branches are stored in the blessed. Contributors forks and works privately Contributors publish their work and ask for merge Integrators merges then publish the contributions 9 / 16

Code sharing: Github workflow blessed pull public Released and official branches are stored in the blessed. Contributors forks and works privately integration private Contributors publish their work and ask for merge Integrators merges then publish the contributions 9 / 16

Code sharing: Github workflow blessed push integration public private Released and official branches are stored in the blessed. Contributors forks and works privately Contributors publish their work and ask for merge Integrators merges then publish the contributions 9 / 16

Code sharing: Github workflow blessed push integration pull pull public push private Public mailing list as public Released and official branches are stored in the blessed. Contributors forks and works privately Contributors publish their work and ask for merge Integrators merges then publish the contributions Git patches can be send by email (git format-patch -1), published in mailing-list (eg. bug-gnu-emacs@gnu.org), then integrated (git am) 9 / 16

Triangular Workflow with pull-requests Developers pull from upstream, and push to a to be merged location Someone else reviews the code and merges it upstream B s public repo merge Upstream merge A s public repo push clone, pull clone, pull push B s private repo A s private repo 10 / 16

Pull-requests in Practice Contributor create a branch, commit, push Contributor click Create pull request (GitHub, GitLab, BitBucket,...), or git request-pull Maintainer receives an email Maintainer review, comment, ask changes Maintainer merge the pull-request The code review is the major point for code quality insurance! 11 / 16

Code Review What we d like: 1. A writes code, commits, pushes 2. B does a review 3. B merges to upstream What usually happens: 1. A writes code, commits, pushes 2. B does a review 3. B requests some changes 4.... then? 12 / 16

Iterating Code Reviews At least 2 ways to deal with changes between reviews: 1. Add more commits to the pull request and push them on top 2. Rewrite commits (rebase -i,... ) and overwrite the old pull request The resulting history is clean Much easier for reviewers joining the review effort at iteration 2 e.g. On Git s mailing-list, 10 iterations is not uncommon. 13 / 16

Code sharing: Linux kernel workflow dictator lieutenant public public public public Code review and basic filtering of contributions is done by the lieutenants Final decision is done by the benevolent dictator Lieutenant repositories are the testbeds of new ideas that mature in it before upstream submission 14 / 16

Code sharing: remote management Remote allows to work with several sources and sink $ git remote add lieutenant git://.../public.git $ git remote origin lieutenant $ git fetch lieutenant... $ git branch -r origin/head -> origin/master origin/master lieutenant/master $ git checkout -b lieutenant lieutenant/master 15 / 16

Branches and tags in practice

Branches and Tags in Practice Create a local branch and check it out: git checkout -b branch-name Switch to a branch: git checkout branch-name List local branches: git branch List all branches (including remote-tracking): git branch -a Create a tag: git tag tag-name 16 / 16