Version Control with Git

Similar documents
Version Control: Gitting Started

Introduction to the UNIX command line

Git & Github Fundamental by Rajesh Kumar.

Introduction: What is Unix?

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

Perl and R Scripting for Biologists

Version control with Git.

Software Development I

Brief Linux Presentation. July 10th, 2006 Elan Borenstein

Effective Software Development and Version Control

Lab Exercise Git: A distributed version control system

Introduction to Unix The Windows User perspective. Wes Frisby Kyle Horne Todd Johansen

Revision Control and GIT

CS 261 Recitation 1 Compiling C on UNIX

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

Git for Version Control

Version Control Systems

How to be a 1337 h4ck3r: Git + Linux

213/513/613 Linux/Git Bootcamp. Cyrus, Eugene, Minji, Niko

UNIX. The Very 10 Short Howto for beginners. Soon-Hyung Yook. March 27, Soon-Hyung Yook UNIX March 27, / 29

CSE 391 Lecture 9. Version control with Git

Introduction to Version Control

INET

Revision Control. An Introduction Using Git 1/15

Lab Objective. Lab Assignment. Downloads and Installation

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

Git for Newbies. ComMouse Dongyue Studio

CSCI 2132 Software Development. Lecture 5: File Permissions

Overview LEARN. History of Linux Linux Architecture Linux File System Linux Access Linux Commands File Permission Editors Conclusion and Questions

Git. Presenter: Haotao (Eric) Lai Contact:

GETTING STARTED WITH. Michael Lessard Senior Solutions Architect June 2017

Linux and Git Boot Camp

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

Warmup. A programmer s wife tells him, Would you mind going to the store and picking up a loaf of bread? Also, if they have eggs, get a dozen.

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

Version control system (VCS)

CS 143A. Principles of Operating Systems. Instructor : Prof. Anton Burtsev

Version Control with Git

Lecture 2: Data in Linguistics, Git/GitHub, Jupyter Notebook. LING 1340/2340: Data Science for Linguists Na-Rae Han

Intro to Linux & Command Line

Lecture 01 - Working with Linux Servers and Git

Version Control. Second level Third level Fourth level Fifth level. - Software Development Project. January 17, 2018

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

Revision control Advanced git

L Modeling and Simulating Social Systems with MATLAB

Eugene, Niko, Matt, and Oliver

Review of Fundamentals

Common Git Commands. Git Crash Course. Teon Banek April 7, Teon Banek (TakeLab) Common Git Commands TakeLab 1 / 18

Version Control. Version Control

CS CS Tutorial 2 2 Winter 2018

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

Unix/Linux Basics. Cpt S 223, Fall 2007 Copyright: Washington State University

Carnegie Mellon. Linux Boot Camp. Jack, Matthew, Nishad, Stanley 6 Sep 2016

Git. Charles J. Geyer School of Statistics University of Minnesota. Stat 8054 Lecture Notes

A quick (and maybe practical) guide to Git and version control. By Jay Johnson

Introduction to Cygwin Operating Environment

Using git to download and update BOUT++

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

CS356: Discussion #1 Development Environment. Marco Paolieri

Working With Unix. Scott A. Handley* September 15, *Adapted from UNIX introduction material created by Dr. Julian Catchen

Using Git to Manage Source RTL

Lec 1 add-on: Linux Intro

Computer Science Design I Version Control with Git

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

Linux at the Command Line Don Johnson of BU IS&T

Source Code Management wih git

CS 390 Software Engineering Lecture 5 More Git

A BASIC UNDERSTANDING OF VERSION CONTROL

Lecture 01: welcome and intro what LSD and Unix have in common

Software Revision Control for MASS. Git Installation / Configuration / Use

Version control. what is version control? setting up Git simple command-line usage Git basics

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

Fundamentals of Git 1

Introduction to Git and Github Repositories


Unix. Examples: OS X and Ubuntu

GIT VERSION CONTROL TUTORIAL. William Wu 2014 October 7

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

EECS Software Tools. Lab 2 Tutorial: Introduction to UNIX/Linux. Tilemachos Pechlivanoglou

Linux Command Line Primer. By: Scott Marshall

Version Control. Version Control

Git better. Collaborative project management using Git and GitHub. Matteo Sostero March 13, Sant Anna School of Advanced Studies

Chapter 5. Version Control: Git

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

Introduction to Linux

Introduction to Scientific Computing

GIT. A free and open source distributed version control system. User Guide. January, Department of Computer Science and Engineering

Overview. 1. Install git and create a Github account 2. What is git? 3. How does git work? 4. What is GitHub? 5. Quick example using git and GitHub

Git tutorial. Katie Osterried C2SM. October 22, 2015

Review of Fundamentals. Todd Kelley CST8207 Todd Kelley 1

CS 246 Winter Tutorial 1

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

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

Unix Basics. Benjamin S. Skrainka University College London. July 17, 2010

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

Submitting your Work using GIT

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

Windows. Everywhere else

How to version control like a pro: a roadmap to your reproducible & collaborative research

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

Transcription:

Version Control with Git Methods & Tools for Software Engineering (MTSE) Fall 2017 Prof. Arie Gurfinkel based on https://git-scm.com/book

What is Version (Revision) Control A system for managing changes to documents, programs, web pages, Maintains a revision history of changes to the document Maintains multiple versions of a document Enables multiple users to collaborate on a common collection of documents There are many revision control systems available rcs, cvs, subversion, mercurial git 2 2

Git Resources From the command line git help to get a list of commands git help <cmd> where <cmd> is a git command (e.g., add, commit, fetch, merge) On-line book https://git-scm.com/book/en/v2 Tutorial https://git-scm.com/docs/gittutorial Interactive Tutorial on GitHub https://try.github.io/ 3 3

Git History Developed by the Linux development community Linux Torvalds, 2005 Initial goals Speed Simple design Strong support for non-linear development (thousands of parallel branches) Fully distributed Able to handle large projects like the Linux kernel efficiently (speed and data size) 4 4

Local Version Control 5 5

Centralized Version Control (subversion) 6 6

Distributed Version Control (git) 7 7

Snapshots, Not Differences differences snapshots 8 8

Common GIT workflow init or clone create an empty repo or make a local copy of a remote repo edit some files, create and modify content add (or stage) mark changes to be combined into a commit a commit is a unit of change, a new version each commit has a globally unique name (i.e., 029389678201859fd6838c8b6c059edd0f17efcf) commit create a commit based on identified changes push propagate changes to remote repo fetch or pull download changes from report repo 9 9

The Three States 10 10

File Life Cycle 11 11

https://try.github.com TO THE CONSOLE! 12 12

Git Internals: Blobs, trees, and commits 13 13

SHA: Secure Hash Algorithm SHA-1 (Secure Hash Algorithm 1) is a cryptographic hash function designed by the United States National Security Agency and is a U.S. Federal Information Processing Standard published by the United States NIST.[3] SHA-1 produces a 160-bit (20-byte) hash value known as a message digest. A SHA-1 hash value is typically rendered as a hexadecimal number, 40 digits long. [Wikipedia] For any message (sequence of characters) computes a 40 digit hex number (a digest) such that the probability that two different messages are assigned the same digest (collision) is very low. Git assigns every piece of content a unique name using its SHA-1 digest. In practice, the first 8 digest are sufficient for uniqueness. You can use sha1sum to compute a digest on command line 14 14

Git Internals: Blobs, trees, and commits 15 15

Commit history 16 16

Commit history and branches 17 17

Creating a branch $ git branch testing 18 18

Switching a branch $ git checkout testing 19 19

Change a file on testing $ <make a change to foo.txt> $ git commit a m a change 20 20

Switch back to master $ git checkout master 21 21

Change a file on master $ <make a change to foo.txt> $ git commit a m change 22 22

Master, develop, topic master stable version only stable, well-tested commits develop development version next version to replace (merge into) master topic experimental bleeding edge test stuff out before merging into develop http://nvie.com/posts/a-successful-git-branching-model/ 23 23

A successful Git branching model http://nvie.com/posts/a-successful-git-branching-model/ 24 24

Example: many issues one solution 25 25

Example: merging things together $ git checkout master $ git merge dumbidea $ git merge iss91v2 26 26

How to Write Git Commit Messages https://xkcd.com/1296/ 27 27

7 Rules of Great Git Commit Messages 1. Separate subject from body with a blank line 2. Limit the subject line to 50 characters 3. Capitalize the subject line 4. Do not end the subject line with a period 5. Use the imperative mood in the subject line 6. Wrap the body at 72 characters 7. Use the body to explain what and why vs. how https://chris.beams.io/posts/git-commit/ 28 28

Crash course on UNIX Methods & Tools for Software Engineering (MTSE) Fall 2017 Prof. Arie Gurfinkel based on https://git-scm.com/book

UNIX Unix (/ˈjuː.nɪks/; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, development starting in the 1970s at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and others. 1970s -- developed at Bell Labs research center 1980s -- popular on many platforms BUT too many forks / extensions (System V, AT&T, BSD, Xenix, ) 1990s fragmented market, niche player 2000s Linux is taking over, Apple is using Unix-based Darwin OS 2010s Linux server market exceeds that of the rest of Unix market https://en.wikipedia.org/wiki/unix 30 30

Shell Command Line Interface Terminal Shell UNIX Operating System Hardware 31 31

32 32

ecelinux.uwaterloo.ca All assignments have to work on ecelinux Use Secure Shell (SSH) client to login from home built-in on Linux/Mac PuTTY on Windows (https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html) First, connect to ecelinux4.uwaterloo.ca using your Quest username and password Second, move to use ssh to hop to one of ecelinux[1-3] work machines $ssh X ecelinux1 Third, once connected start bash shell (unless bash is your def shell) $bash l If in doubt about any questions, answer Yes J 33 33

Basic Shell Commands Command pwd cd folder ls ls -la ls folder mkdir p folder rm rf folder touch filename rm filename cat filename less filename man command Description display current working directory change working directory to folder list files in the current directory list files including hidden files and display lots of information list files in a given folder create a folder (and necessary sub-folders) recursively delete a given folder create a blank file with a given name delete a file with a given name prints a content of a file onto standard output display a content of a file display a manual page on command there are many more commands and many online tutorials 34 34

Fun with shell and pipes List a first/last few entries of a file $cat file head n 20 $cat file tail Find all unique words in a file and their occurrences $cat file sort uniq c sort Save output of a command to a file $ls > output.txt Save output (stdout and stderr) and display it $ls 2>&1 tee output.txt Searching (grepping) for a string in the output $cat file grep MYSTRING Searching for a file by name $find [folder] name *filename* man command or command help or google for help 35 35

Transferring files between ecelinux Use Secure Copy (scp/sftp) to transfer files to ecelinux4 they are immediately available on all ecelinux machines Much better way use Git!!! commit and push from your working machine to github fetch or pull from ecelinux If you don t have a local Linux environment, use a local virtual machine. Only use ecelinux for final testing and initial exploration Instructions for setting up a virtual machine https://ece.uwaterloo.ca/~agurfink/ece650/tutorial/2017/08/25/virtual-box 36 36

Which editor to use? https://xkcd.com/378/ 37 37

https://xkcd.com/1823/ 38 38

So what editor to use? Use your favorite editor or IDE on your machine atom, sublime, notepad++, visual studio, xcode, eclipse, etc. Use a simple text editor on ecelinux (or another terminal) pico, nano Use vi or vim (Vi Improved) there are gui versions available for virtually every platform My editor of choice is emacs configured using prelude: https://github.com/bbatsov/prelude used with EVIL mode: https://github.com/emacs-evil/evil 39 39