GitHub workflow according to Google

Slides:



Advertisements
Similar presentations
Simple Git Steve Pieper. Topics Git considerations and Slicer Git as if it were svn Git the way it is meant to be.
Advertisements

Git Branching What is a branch?. Review: Distributed - Snapshots Files are stored by SHA-1 hash rather than filename Stored in git database in compressed.
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.
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 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,
Git – versioning and managing your software L. Grewe.
Git A distributed version control system Powerpoint credited to University of PA And modified by Pepper 8-Oct-15.
Branching. Version Control - Branching A way to write code without affecting the rest of your team Merge branches to integrate your changes.
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.
Information Systems and Network Engineering Laboratory II DR. KEN COSH WEEK 1.
Object-Oriented Analysis & Design Subversion. Contents  Configuration management  The repository  Versioning  Tags  Branches  Subversion 2.
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.
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.
Information Systems and Network Engineering Laboratory I DR. KEN COSH WEEK 1.
Thanks to our Sponsors! Community Sponsor Yearly Sponsor Marquee Sponsor.
Git How to 1. Why Git To resolve problems in lab exams (accidental deletions) Use existing Libraries with ease (Statistics and Computer) Prepare undergraduates.
Using Git with collaboration, code review, and code management for open source and private projects. & Using Terminal to create, and push commits to repositories.
1 Ivan Marsic Rutgers University LECTURE 2: Software Configuration Management.
Git workflows: using multiple branches for parallel development SE-2800 Dr. Mark L. Hornick 1.
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
GIT Version control. Version Control Sharing code via a centralized DB Also provides for Backtracking (going back to a previous version of code), Branching.
Adam Young Presented by Senior Software Engineer, Red Hat License Licensed under PKI, Git and SVN.
KIT – University of the State of Baden-Wuerttemberg and National Research Center of the Helmholtz Association STEINBUCH CENTRE FOR COMPUTING - SCC
CS5220 Advanced Topics in Web Programming Version Control with Git
Introduction to GitHub
Information Systems and Network Engineering Laboratory II
I Don’t Git It: A beginner’s guide to git Presented by Mathew Robinson
11 Version control (part 2)
A Simple Introduction to Git: a distributed version-control system
LECTURE 2: Software Configuration Management
Git Practice walkthrough.
CS4961 Software Design Laboratory I Collaboration using Git and GitHub
Version control, using Git
CS5220 Advanced Topics in Web Programming Version Control with Git
Software Engineering for Data Scientists
Macaualy2 Workshop Berkeley 2017
SU Development Forum Introduction to Git - Save your projects!
Distributed Version Control with git
Akshay Narayan git up to speed with RCS Akshay Narayan
(Advanced) Web Application Development
Anatomy of a Git Project
Version Control with git
LECTURE 3: Software Configuration Management
The Big Picture
Part 1: Editing and Publishing Files
Git Best Practices Jay Patel Git Best Practices.
Git CS Fall 2018.
Version Control System - Git
Version control with Git
Version Control with Git
GitHub and Git.
Version Control with Git and GitHub
GitHub 101 Using Github and Git for Source Control
Git Introduction.
Git GitHub.
Introduction to The Git Version Control System
How l learned to work with others instead of working around them.
Using GitHub for Papyrus Models Jessie Jewitt – OAM Technology Consulting/ ARM Inc. January 29th, 2018.
Presentation transcript:

GitHub workflow according to Google Golosova Marina

Git after Subversion: unsafe history Subversion stores commit history as it was written originally. Once committed – lasts forever. Good for credibility, pain for perfectionism. In Git the commit history can be rewritten or removed – and not only locally, but also in the central (remote) repository. Good for perfectionism, dangerous for associates. Unstable history is the main reason why GitHub is not friendly to the commit notifications by e-mail git push != svn commit == merged pull request 01.06.2017

Workflow v.01.06.2017 01.06.2017

Workflow (1) Original Fork Local push push push push Request accepted and merged GitHub: pull request 6.1 6.5 Stable Branch (readonly) Changes required MyChanges2 Original git pull upstream or git pull 6.1 6.2 1.1 GitHub: fork git push –u origin MyChanges2 5 7 push Stable Branch (writable copy) MyChanges Draft MyChanges1 Fork push push push git push --force 1.2 8 5 Working (draft) Branch (+N commits) Working (fair) Branch (rebase -i) 6.4 Working (fair) Branch (rebase -i) Stable Branch (local copy) Local 4.1 2 git clone <fork> git remote add upstream <original> or git clone <original> <commitA> 4.1 git branch new-branch git checkout new-branch or git checkout –b new-branch git commit // <commitB> git commit // <commitC> … git commit // <commitX> git checkout –b fair-branch1 git rebase –i <commitA> pick <commitA> edit <commitB> drop <commitC> pick <commitD> squash <commitE> fixup <commitF> … git checkout –b fair-branch2 git rebase –i <commitA> drop <commitA> drop <commitB> pick <commitC> drop <commitD> drop <commitE> drop <commitF> … git commit … [git rebase -i] 6.3 3 4.2 01.06.2017 4.2

Workflow (2) Create local copy: Fork (via GitHub) (optionaly) Clone (locally) Add upstream (for fork) Create a working branch for your changes see: why not to work in the “original” branch, Slide 14 Commit your changes locally see: when to push your changes to GitHub, Slide 15 Make-up the commit history Create a new “fair” branch if there are more changes in the working branch than needed for one pull request if you’re going to keep on working in the branch after the pull request is sent Use rebase –i to rewrite the commit history Push the “fair” branch to GitHub 01.06.2017

Workflow (3) Pull request Create request via GitHub If the reviewer ask you for changes: go the local “fair” branch make changes required rewrite the history (if needed) push new commits to GitHub (use --force, if the previously pushed part of the history was changed) … Request is accepted and merged to the stable branch: Rebase + merge (fast-forward merge) for obvious cases (when there were no changes in the branch in parallel to the request Merge (with merge commit) when fast-forward is not applicable without rebase Squash (???) is not an option Remove the remote request branch (at least in the original repository) 01.06.2017

Workflow (4) Update local copy Update fork repository git pull [upstream (for fork case)] Update fork repository git push 01.06.2017

Git Keywords 01.06.2017

Keywords Pull – take (fetch) actual version from remote repository and merge local changes with it Push – put local commits to remote repository Push --force – overwrite remote history and current state with local version. To be used only in personal temporary branches (like those for pull request). Pull request – “I have some good commits here, please add (pull) them to the stable branch” Original / central repository – PanDAWMS/dkb Fork repository – mgolosova/dkb (copy of the PanDAWMS/dkb on the GitHub side) 01.06.2017

Keywords: rebase Rebase {<commit> | <branch>} – rewrite the history (reapply commits on top of another base tip) HEAD – “you-are-here”, last commit in the current branch <commit>~<N> -- N commits earlier than <commit> A---B---C topic / D---E---F---G master A'--B'--C' topic / D---E---F---G master git rebase master topic o---o---o---o---o master \ o---o---o---o---o next o---o---o topic o---o---o---o---o master | \ | o'--o'--o' topic \ o---o---o---o---o next git rebase --onto master next topic git rebase --onto topicA~5 topicA~3 topicA E---F---G---H---I---J topicA E---H'---I'---J' topicA 01.06.2017

Keywords: rebase rebase –i <commit> Interactive rebase Rewrite the history: reorder commits, drop them, edit, squash – whatever 01.06.2017

Keywords: reset <=> Reset <commit> git reset --soft HEAD~1 set HEAD to <commit> (--soft) remove changes between <commit> and last commit made before reset from index (--mixed) (default) rewrite working directory to <commit> version (--hard) git reset --soft HEAD~1 vi myFile.txt git add myFile.txt git commit vi myFile.txt git add myFile.txt git commit --amend <=> More info: https://git-scm.com/ 01.06.2017

Why & When 01.06.2017

Why …(not) to fork the repository? …not to work in a local copy of the original branch? no merge problems when pull actual version from the original repository there`s always a branch in the actual state to branch off of less possibility to erroneously push to the original …not to use push --force anywhere but your own working space (temporary commit branches, personal development branches, fork repository…)? when the remote repository forcefully updated, the existing commit history can be rewritten if your local copy is behind the remote version, you forceful update will erase someone else`s work (--force-with-lease helps here) if someone has already pulled the previous history version and started to work on it, in the future the updated remote version might be harmful for the local changes …(not) to fork the repository? (+) less temporary branches in the original repository Lots of branches looks like a mess, but: temporal working branches are to be removed after pull request (shall we use some prefix for them?) pull request branches are to be removed after merge human-related branches – our team is not so big to make it a problem (-) extra work to keep the fork up to date (pull upstream + push to fork every now and then) (-) no one can see if you`re working hard or do nothing without checking your fork version intentionally 01.06.2017

When …to push to the remote repository? …to create a pull request? work is finished work is not finished, but you believe that a part of it is successfully done and want to “isolate” this part from the next one logically you want to declare “I`m working on it, here`s the current state” …to create a pull request? work is not finished, but you want to ask someone for review and discuss your course (do not forget to add [WIP] (work in progress) marker (tag, or prefix to the request title)) 01.06.2017

That`s it 01.06.2017