Git All hail the octo-cat

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.
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.
Patterns & practices Symposium 2013 Introducing Git version control into your team Mark
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
Subversion. What is Subversion? A Version Control System A successor to CVS and SourceSafe Essentially gives you a tracked, shared file system.
علیرضا فراهانی استاد درس: جعفری نژاد مهر 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 ?
ITEC 370 Lecture 16 Implementation. Review Questions? Design document on F, feedback tomorrow Midterm on F Implementation –Management (MMM) –Team roles.
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.
Team 708 – Hardwired Fusion Created by Nam Tran 2014.
GIT.
Intro to Git presented by Brian K. Vagnini Hosted by.
Page 1 TBD 12/08/2014 Formation GIT Laurent Kappel Groupe SII 65, rue de Bercy Paris Tél : Fax :
Version Control and SVN ECE 297. Why Do We Need Version Control?
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.
Information Systems and Network Engineering Laboratory I DR. KEN COSH WEEK 1.
Git In The Land of Version Control Systems A tutorial on getting git.
Collaborative Git An introduction to Git with others
Git Girish Git VCS that I have used ClearCase, cvs, svn Happy p4 user.
GIT: (a)Gentle InTroduction Bruno Bossola. Agenda About version control Concepts Working locally Remote operations Enterprise adoption Q&A.
KIT – University of the State of Baden-Wuerttemberg and National Research Center of the Helmholtz Association STEINBUCH CENTRE FOR COMPUTING - SCC
Version Control Systems
Basics of GIT for developers and system administrators
CS5220 Advanced Topics in Web Programming Version Control with Git
Information Systems and Network Engineering Laboratory II
Primož Gabrijelčič Git for Programmers Primož Gabrijelčič
Version Control Systems
Version Control with Subversion
11 Version control (part 2)
CReSIS Git Tutorial.
LECTURE 2: Software Configuration Management
Version Control.
Git Practice walkthrough.
CSE 374 Programming Concepts & Tools
CS5220 Advanced Topics in Web Programming Version Control with Git
Version Control System using Git
Git branches and remotes
Development and Deployment
Software Engineering for Data Scientists
Version Control with Git and GitHub
Version Control Systems
Version Control System
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
SIG: Open Week 1: GitHub Tim Choh.
Git CS Fall 2018.
Version Control System - Git
Version control with Git
Introduction to Version Control with Git
Version Control with Git
Version Control with Git and GitHub
GitHub 101 Using Github and Git for Source Control
Git Fundamentals.
Introduction to The Git Version Control System
Advanced Git for Beginners
Presentation transcript:

Git All hail the octo-cat Sean Dague http://dague.net

The Bad (not so) Old Days

Selective SCM History SCCS Original source code control system Local only, single file at a time RCS GNU implementation of local SCM (same basic limitations as SCCS) CVS Wrapped RCS with concept “changesets” Provided a network server

Selective SCM History SVN “CVS done right” global repository versioning support for file renames Bitkeeper Not open source Designed around Linux Kernel workflow license revoked “reverse engineering” spat Then the anti market kicked in... git, hg, monotone, bzr

The Concurency Issue Master Tree Sean Joe

The Locking Solution Master Tree Sean Joe

The Opportunistic Locking Solution Master Tree Sean Joe

The Keep Everything Solution Master Tree Sean Joe

The Keep Everything Solution Master Tree Sean Keep this in mind, we'll come back to it later Joe

Content Addressable Storage /home/sdague/foo.txt Inode: 569 Some file

Content Addressable Storage /home/sdague/foo.txt SHA1: f4ed8388... Some file Inode: 569

Content Addressable Storage cp foo.txt foo2.txt /home/sdague/foo.txt /home/sdague/foo2.txt SHA1: f4ed8388... Some file Inode: 569

Content Addressable Storage It doesn't matter where the file is, if it's the same contents /usr/local/file.txt /home/sdague/foo.txt SHA1: f4ed8388... SHA1: f4ed8388... Inode: 569 Some file

CAS + Directed Graph Courtesy http://learn.github.com

Git Truisms Changes in local content addressable storage Uses cryptographically strong SHA1 hash to identify changes Each change includes a reference to the parent change(s) that it is based Every repository is an equal clone Git makes it really hard to loose data

Git Basic Commands Network/Repo init – create a new repository clone – make a local copy of a tree pull – update tree from remote tree push – push changes to remote tree Making Changes add – add a file to be versioned commit – add changes rm – remove a file mv – move a file (often not needed)

Git Basic Commands Inspecting diff - show what's changed log - show a time linear log of changes status - show what would be commited on a commit Oh Crap! Undo! Undo! Undo! reset --hard - get back to the last commit checkout -- $file - reset a single file from commit revert $version - revert a previous commit

Simple git workflow for 1 git clone $repo make changes git add $file1 $file2 … git commit -a rinse, wash, repeat git push Demo time!

Branching Quick in tree branching is one of the git selling points Branching Commands branch - displays current branches branch $name - creates a new branch checkout $name - switches to a branch You'll get yelled at if you try to switch branches with outstanding changes.

Merging Most of the time, it just happens and you don't realize it Commands that merge pull - automatically generates a merge commit if needed merge - for manual operations, you rarely need this

A note on diagrams to come Arrows point in flow direction instead of towards parents Different colors are meant to represent different hash values Courtesy http://learn.github.com

Branching & Merging Master Tree Ok, we're keeping everything but now we have a new problem. Which change represents head? Bug 1 Bug 2

Rules of Trees A branch should only have 1 head. If you do something that would make a second head, git will try to stop you A changeset can have more than 1 parent A changeset doesn't need to have content in the traditional sense

Merging Master Tree Can't push from bug 1 branch because it would make 2 headed master Bug 1 Bug 2

Merging Master Tree git pull pulls down changes Bug 1

Merging Master Tree git pull pulls down changes automatically builds a merge commit Bug 1

Merging Master Tree now a git push works correctly Bug 1

Merging Master Tree And once we are all done we have identical trees Bug 1

Merging with conflicts Git will handle most merges automatically new files file renames multiple changes in files (as long as they aren't the same lines) combinations of the above If git can't automatically create the merge commit it will stop and dump out to an interactive mode. You manually create the fix up patch that lets things move forward

Fixing Screwups reset --hard revert checkout -- uncommitted files

Rebase... there be dragons... There is another merge like operations that deserves attention - rebase rewrites your changesets to be based on a different parent common usage for side patches private fixes you can't release (yet) working changes for upstream Important: do not publicly expose rebased trees, it makes life difficult for everyone

Rebase Master Tree Bug 1

Rebase Master Tree rebase first pulls in all the new changes from the target tree Bug 1

Rebase Master Tree rewrites your changes to be against a new parent Bug 1

Rebase Master Tree Destroys old changes Bug 1

Rebase Master Tree Destroys old changes Bug 1

Rebase Master Tree Rebase does not push changes. At this point you could push cleanly, or hold onto your changes for future rebasing Bug 1

Why you don't rebase public trees Master Tree Bug 1 Bob

Why you don't rebase public trees Master Tree Bug 1 Bob now can't make a sane merge tree with Bug 1, as it got rid of changes his merge was working with Bob

Why you don't rebase public trees Master Tree The fix sucks. First you have to purge out nodes in your tree (through creating a branch and rewinding). Then 1 rebase against the new base. Bug 1 Bob

Why you don't rebase public trees Master Tree Bug 1 Then another rebase against the newly pulled changes. Bob

Git with teams When using git with multiple people the typical pattern is that everyone has 1 or more public trees and pull is used to integrate other people's changes. push is really only used within a set of trees/branches that you own.

Git with teams Sean Master Tree Sean Working Joe Working

Git with teams Sean Master Tree changes are done, pull into master Sean Working Joe Working

Git with teams Sean Master Tree Joe is ready to get his changes in, so he syncs with master, and puts his tree up somewhere public Sean Working Joe Working

Git with teams Sean Master Tree Sean pulls in Joe's changes including the merge into public master Sean Working Joe Working

Git with teams Sean Master Tree Rinse, Wash Sean Working Joe Working

Git with teams Sean Master Tree Rinse, Wash Repeat Sean Working Joe Working

Setting up your own public repo If it's open source, consider using github.com if on ubuntu/debian use git-daemon-run uses a git custom protocol to get changes it is also possible to set up git server with vanilla http it's over 100x slower for large trees

Git Advantages O(1) runtime for access to changes Cryptographicly secure Branching/Merging make it really simple to try out new things Very space efficient Versions metadata as well as data (+x bits) No bloody line ending convert games Plays mostly well with others

Git Gui (Linux)

More Bits of Git Windows Support via TortoiseGit (like TortoiseSVN) complete enough now that git on windows is a real otpion git-svn bridge extendable via plugins git format-patch / send-email - for email workflows

Learning more on Git http://learn.github.com/ consult your man pages

Backup