A Simple Introduction to Git: a distributed version-control system

Slides:



Advertisements
Similar presentations
Intro to Version Control Have you ever …? Had an application crash and lose ALL of your work Made changes to a file for the worse and wished you could.
Advertisements

Version Control System Sui Huang, McMaster University Version Control SystemSui Huang, McMaster University Version Control System -- base on Subversion.
Using subversion COMP 2400 Prof. Chris GauthierDickey.
Version Control Systems Phil Pratt-Szeliga Fall 2010.
Hosted Git github. From an alumni (2010)  You know, the more time I spent in industry the better I've understood what a strong advocate you are for the.
A Simple Introduction to Git: a distributed version-control system CS 5010 Program Design Paradigms “Bootcamp” Lesson 0.5 © Mitchell Wand, This.
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.
BIT 285: ( Web) Application Programming Lecture 07 : Tuesday, January 27, 2015 Git.
Git for Version Control These slides are heavily based on slides created by Ruth Anderson for CSE 390a. Thanks, Ruth! images taken from
Getting Started with GIT. Basic Navigation cd means change directory cd.. moves you up a level cd dir_name moves you to the folder named dir_name A dot.
With Mercurial and Progress.   Introduction  What is version control ?  Why use version control ?  Centralised vs. Distributed  Why Mercurial ?
Git – versioning and managing your software L. Grewe.
Moodle (Course Management Systems). Forums, Chats, and Messaging.
ITEC 370 Lecture 16 Implementation. Review Questions? Design document on F, feedback tomorrow Midterm on F Implementation –Management (MMM) –Team roles.
…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.
Information Systems and Network Engineering Laboratory II DR. KEN COSH WEEK 1.
Version Control.
CVS – concurrent versions system Network Management Workshop intERlab at AIT Thailand March 11-15, 2008.
Dealing with Conflicting Updates in Git CS 5010 Program Design Paradigms “Bootcamp” Lesson 0.6 © Mitchell Wand, This work is licensed under a.
A Simple Introduction to Git: a distributed version-control system CS 5010 Program Design Paradigms “Bootcamp” Lesson 0.5 © Mitchell Wand, This.
Intro to Git presented by Brian K. Vagnini Hosted by.
Version Control and SVN ECE 297. Why Do We Need Version Control?
Hosted Git github. From an alumnus (2010)  You know, the more time I spent in industry the better I've understood what a strong advocate you are for.
Information Systems and Network Engineering Laboratory I DR. KEN COSH WEEK 1.
Introduction to Git - Chirag Dani. Objectives Basics of Git Understanding different “Mindset of Git” Demo - Git with Visual Studio.
© Trustees of Indiana University Released under Creative Commons 3.0 unported license; license terms on last slide. Take Group Projects to the Next Level.
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.
BIT 285: ( Web) Application Programming Lecture 07 : Tuesday, January 27, 2015 Git.
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.
Collaborative Git An introduction to Git with others
Version Control Systems
Basics of GIT for developers and system administrators
Information Systems and Network Engineering Laboratory II
Source Control Systems
Discussion #11 11/21/16.
I Don’t Git It: A beginner’s guide to git Presented by Mathew Robinson
Version Control with Subversion
LECTURE 2: Software Configuration Management
GitHub workflow according to Google
Discussion 11 Final Project / Git.
Damned if you do and Damned if you don’t
A Simple Introduction to Git: a distributed version-control system
Halting Functions for Tree-Like Structures
CS 5010 Program Design Paradigms “Bootcamp” Lesson 4.1
Version Control with Git and GitHub
Macaualy2 Workshop Berkeley 2017
Version Control Systems
Version Control System
Version Control with Git accelerated tutorial for busy academics
Akshay Narayan git up to speed with RCS Akshay Narayan
LECTURE 3: Software Configuration Management
Introduction to Configuration Management
The Big Picture
Getting Started with Git and Bitbucket
Part 1: Editing and Publishing Files
User Guide Subversion client TortoiseSVN
GitHub A Tool for software collaboration James Skon
Version control with Git Part II
Git CS Fall 2018.
Version Control System - Git
Git started with git: 2018 edition
Version Control with Git
GitHub and Git.
Systems Analysis and Design I
Git GitHub.
Using GitHub for Papyrus Models Jessie Jewitt – OAM Technology Consulting/ ARM Inc. January 29th, 2018.
Presentation transcript:

A Simple Introduction to Git: a distributed version-control system CS 5010 Program Design Paradigms “Bootcamp” Lesson 0.5 © Mitchell Wand, 2012-2017 This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.

Learning Objectives At the end of this lesson you should be able to explain: how git creates a mini-filesystem in your directory what pull, commit, and push do the elements of the basic git workflow how git allows you to work across multiple computers

Git is a distributed version-control system You keep your files in a repository on your local machine. You synchronize your repository with a repository on a server. If you move from one machine to another, you can pick up the changes by synchronizing with the server. If someone else on your team uploads some changes to your files, you can pick those up by synchronizing with the server.

Git is a distributed version-control system Terminology: In git-speak, a “version” is called a “commit.” Git keeps track of the history of your commits, so you can go back and look at earlier versions, or just give up on the current version and go back some earlier version.

A simple model of git Most git documentation gets into details very quickly. Here’s a very simple model of what’s going on in git.

Here are your files, sitting in a directory called my-project docs manual.docx user_docs.docx src main.rkt module1.rkt module2.rkt module3.rkt Here are your files, sitting in a directory called my-project

Your files in your git repository my-project docs manual.docx user_docs.docx src main.rkt module1.rkt module2.rkt module3.rkt .git When you have a git repository, you have an additional directory called .git, which points at a mini-filesystem. This file system keeps all your data, plus the bells and whistles that git needs to do its job. All this sits on your local machine.

The git client my-project docs manual.docx user_docs.docx src main.rkt module1.rkt module2.rkt module3.rkt .git This mini-filesystem is highly optimized and very complicated. Don’t try to read it directly. The job of the git client is to manage this for you.

Your workflow (part 1) You edit your local files directly. You can edit, add files, delete files, etc., using whatever tools you like. This doesn’t change the mini-filesystem, so now your mini-filesystem is behind.

A Commit my-project docs manual.docx user_docs.docx src main.rkt module1.rkt module2.rkt module3.rkt .git commit When you do a “commit”, you record all your local changes into the mini-filesystem. The mini-filesystem is “append-only”. Nothing is ever over-written there, so everything you ever commit can be recovered.

Synchronizing with the server (1) a server, somewhere on the internet, eg. github.com your local machine my-project docs manual.docx user_docs.docx src main.rkt module1.rkt module2.rkt module3.rkt .git push At the end of each work session, you need to save your changes on the server. This is called a “push”. Now all your data is backed up. You can retrieve it, on your machine or some other machine. We can retrieve it (that’s how we collect homework)

Synchronizing with the server (2) a server, somewhere on the internet, eg. github.com your local machine my-project docs manual.docx user_docs.docx src main.rkt module1.rkt module2.rkt module3.rkt .git pull pull To retrieve your data from the server, you do a “pull”. A “pull” takes the data from the server and puts it both in your local mini-fs and in your ordinary files. If your local file has changed, git will merge the changes if possible. If it can’t figure out how to the merge, you will get an error message. We’ll talk about this some more a little later in this lesson.

The whole picture a server, somewhere on the internet, eg. github.ccs.neu.edu your local machine push my-project docs manual.docx user_docs.docx src main.rkt module1.rkt module2.rkt module3.rkt .git pull pull commit

Your workflow for a session pull edit commit push If you want to abandon your changes, you can always go back to your preceding commit, using “git checkout”. (Go read about “git checkout”, which does lots of useful things…) Start by pulling the latest version of your work from the server Best practice: commit your work whenever you’ve gotten one part of your problem working, or before trying something that might fail. At the end of each session: Update your-ID-log.txt Commit push

Submitting a Work Session log At the end of your work session, update a file called your-ID-log.txt (replace “your-ID” with your CCIS login ) This file records the time you spent in this work session. 0 hours 0 minutes spent this session 2017-01-06 I hereby certify that all the work in this commit is my own except for materials distributed as part of this class. /* do not change the format of anything above this line */ After each work session, please update and commit this file (with 'yourID' replaced by your CCIS login name), updating the first two lines with the amount of time you spent working and the date when you stopped. You may also record any notes you wish to make about what you did during the session. Every commit of this file constitutes a work log entry. Each entry should replace the previous one, so there will only be one session recorded at any particular version of this file. Do *not* change the format of the first four lines, as the course staff will use automated tools to track the amount of time students spend on each problem set.

Your workflow over multiple sessions You pull the latest version of your work from the server You, maybe on another computer You You pull edit commit push pull edit commit push pull edit commit push server server You push your work to the server You update your-ID-log.txt at the end of each session

Oh no! I’ve got a git conflict If you update your work before you pull, git will try to merge the changes when you do pull. If git can’t figure out how to do the merge, it will go into a special mode in which it expects you to resolve the conflicts. When you have the files the way you want them, you can commit them and continue working. Here’s a guide. Since you will not be working in pairs, this is unlikely to happen too often.

Other ways to use git and github There are lots of possible ways to use git and github. We only care about the “master” branch If you know git well, and you want to do something fancier with multiple branches, merges, and whatnot, feel free to do so. But you should be able to get by just fine with just a single master branch. We believe in the KISS principle: “Keep It Simple, Stupid!”

Summary In this lesson you have learned that git creates a mini-filesystem in your directory what pull, commit, and push do the elements of the basic git workflow how git allows you to work across multiple computers.

Next Steps There are many interactive git tutorials on the web. Go find one and do it. If you find one you like, recommend it to your classmates on the Discussion Board. If you have questions about this lesson, ask them on the Discussion Board. Go on to the next lesson.