CS 390 Software Engineering Lecture 4 - Git

Similar documents
CS 390 Software Engineering Lecture 5 More Git

A BASIC UNDERSTANDING OF VERSION CONTROL

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

Computer Science Design I Version Control with Git

Version Control with GIT

Version Control Systems

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

! #Running this command from the top directory of your project will add all your changes."! $ git add."

Using git to download and update BOUT++

Git. Presenter: Haotao (Eric) Lai Contact:

Tutorial: Getting Started with Git. Introduction to version control Benefits of using Git Basic commands Workflow

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

Revision control Advanced git

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

Version Control: Gitting Started

1/20/13 Git tutorial. Git tutorial. Mike Nolta. file:///users/nolta/github/reveal.js/git.html?print-paper#/ 1/31

Introduction to Version Control with Git

Git Introduction CS 400. February 11, 2018

Submitting your Work using GIT

Advanced Operating Systems Control Versioning with GIT. Giuseppe Massari

Software Project (Lecture 4): Git & Github

What is Git? What is Git? Version Control. Barry Grant

License. Introduction to Version Control with Git. Local Version Control Systems. Why Use Version Control?

Configuring Git. Matthieu Moy. configuring-git-slides.

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

Outline. Version Control System (VCS) basics Git terminology & concepts Basic Git commands Branches in Git Git over the network (time permitting)

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

GUIDE TO MAKE A REAL CONTRIBUTION TO AN OPEN SOURCE PROJECT 1. 1

LAB MANUAL GIT BY PRATIK JAIN. To start with git bash, we need to authenticate ourselves so that for every commit, git can use this information.

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:

Git tutorial. Katie Osterried C2SM. October 22, 2015

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

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

Version Control. Version Control

A Brief Introduction to Git. Sylverie Herbert (based on slides by Hautahi Kingi)

Intermediate Programming, Spring Misha Kazhdan

Lab Exercise Git: A distributed version control system

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

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

Outline. Introduction to Version Control Systems Origins of Git Git terminology & concepts Basic Git commands Branches in Git Git over the network

Improving Your Life With Git

Version Control. Version Control

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

1. Git. Robert Snapp

GIT FOR SYSTEM ADMINS JUSTIN ELLIOTT PENN STATE UNIVERSITY

John DeDourek Professor Emeritus Faculty of Computer Science University of New Brunswick GIT

Chapter 5. Version Control: Git

CSE 391 Lecture 9. Version control with Git

A brief introduction to the GitLab service at the department

Version control with Git.

Outline. Introduction to Version Control Systems Origins of Git Git terminology & concepts Basic Git commands Branches in Git Git over the network

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

6 Git & Modularization

Revision control. INF5750/ Lecture 2 (Part I)

Git, the magical version control

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

A Brief Git Primer for CS 350

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

VCS VERSION CONTROL SYSTEMS

I m an egotistical bastard, and I name all my projects after myself. First Linux, now git. Linus Torvalds, creator of Linux and Git

Git for Version Control

CS 520: VCS and Git. Intermediate Topics Ben Kushigian

Barry Grant

Fundamentals of Git 1

GETTING STARTED WITH. Michael Lessard Senior Solutions Architect June 2017

Algorithm Engineering

CS 390 Software Engineering Lecture 3 Configuration Management

Git version control with Eclipse (EGit) Tutorial

Assumptions. GIT Commands. OS Commands

Introduction to Git and Github

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

Introduction to distributed version control with git

Repositories, Directories and Files

Object Oriented Programming. Week 1 Part 2 Git and egit

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

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

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

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

Git Branching. Chapter What a Branch Is

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

EECS 470 Lab 4. Version Control System. Friday, 31 st January, 2014

Re-implementing git. (a small part at least) Thibault Allançon November 2018

DEAD-SIMPLE VERSION CONTROL FOR YOUR TEAM GIT WITH MATTHEW REIDSMA GRAND VALLEY STATE UNIVERSITY

Git Tutorial. Version: 0.2. Anders Nilsson April 1, 2014

Git Immersion Rails Conf 2010 Tutorial

From Commits to Collaboration: A Git Tutorial for Social Scientists

Version control with git and Rstudio. Remko Duursma

Git Guide. Meher Krishna Patel. Created on : Octorber, 2017 Last updated : October, More documents are freely available at PythonDSP

(Cloud9) and to the Remote Repository (GitHub)

Version Control System - Git. zswu

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

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

Version Control with Git

Git & Github Fundamental by Rajesh Kumar.

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

Managing Network Configurations with Git and GitLab

CSCI 1010 Computer Science Orientation Introduction to version control

BIMM 143. Find-a-Gene Project Assignment. Find a Gene Assignment. Barry Grant. Lecture 10.

Pragmatic Guide to Git

Version Control with GIT: an introduction

Transcription:

CS 390 Software Engineering Lecture 4 - Git Reference: Scott Chacon and Ben Straub, Pro Git, published by Apress, available at https://git-scm.com/book/en/v2.

Outline Git terminology Git configuration Git structure Local repository 2

Git Terminology Term Change Clean Commit Log Explanation Whenever a file in the working directory is altered such that it is different from the one that is stored in the repository, this is called a change. Adding or removing a file is also a change. Changes are not saved until they have been committed to the repository. A working directory is clean if there are no changes. That is, there are no files that are different from the ones in the most recent commit in the repository. A commit is a set of staged changes that are added atomically to the repository. Committing in git is a 2-phase process. First changes are staged by adding them to the index, an intermediate place, and then the index is committed to the repository, which makes a permanent record of the changes in the log. The complete history of the commits made to a repository. 3

Git terminology Term Repository Staged Working directory Explanation The database of the entire history of a project. In git, this is stored inside the working directory in a hidden subdirectory. For a project, a repository is either initialized by the user, in which case it has a completely empty history, or is cloned from an preexisting repository on a server somewhere. Changes are staged by adding them to the index, an intermediate place. At the time a change is staged, only the changes at the time of the add are staged. This is the directory that contains your project. It will have a hidden repository within it. 4

Basic git configuration When a commit is done, git marks the log entry with information about the user doing the commit MInimally, the user's name and email address should be set explicitly. $ git config --global user.name "John Doe" $ git config --global user.email johndoe@example.com This information is stored in ~/.gitconfig or ~/.config/git/config depending on the distribution 5

Git structure Git stores information in a database. By default it is an SQLlite database. Files are compressed and stored as blobs. Commits are indexes of files and metadata. Project is a tree of commit indexes. Branches are pointers to particular commit indexes. The current branch is indicated by the HEAD. 6

Local repository Any directory can be used as a git repository Initialize a new git repository $ git init Repository information is stored in hidden.git subdirectory. Generally, will not need to access this directly. 7

Staging changes A change is anything that is in a working directory that is not the same as the repository, i.e., the most recent commit. Modified files New files Deleted files Changes to be committed must be staged. That is, information about the change is added to an index. $ git add <filename> 8

Staging changes When a change is staged, the information reflects the state of the file at the time of the add. If more modifications are made to a file, it must be added again before committing. When there are many changes, it may be easier to add everything in the working directory that has changed. $ git add. Since not all files need to be tracked (e.g., *.o files), a list of files that should be ignored may be given in a.gitignore file. 9

Committing a project To see what files have been or need to be staged, look at the status of the project. $ git status Once all of the relevant changes have been added (or added to the.gitignore file), commit the project $ git commit -m "message" After a commit, the working directory is said to be clean. Files that have been committed are also said to be tracked. Once a file becomes tracked, git expects changes to it be staged before commits unless it is removed. 10

Commit log To view the record of commits $ git log The default listing is in reverse chronological order and each entry has an SHA1 checksum, name and email of the user that did the commit, and the date/time of the commit. There are various options that present other information or other formats. 11

Undoing things Redoing a commit. E.g., forgetting to add a file. $ git commit amend Unstaging a file. $ git reset HEAD <filename> Unmodifying a modified file. This is checking out the last committed version of the file. All of the changes will be lost, so be careful using it. $ git checkout -- <filename> 12

Branching Branch called master is created by default. Create a new branch. The branch starts out the same as the last committed version of current branch. $ git branch <branch name> Must switch to a branch by checking it out $ git checkout <branch name> Switching back to another branch restores the most recent committed version of that branch. 13