Git. A fast distributed revision control system. Nils Moschüring PhD Student (LMU)

Similar documents
Outline The three W s Overview of gits structure Using git Final stuff. Git. A fast distributed revision control system

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

Introduction to distributed version control with git

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

Git(Lab) Tutorial and Hands-On

Revision control. INF5750/ Lecture 2 (Part I)

CS 390 Software Engineering Lecture 5 More Git

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:

Version Control System - Git. zswu

Git for Subversion users

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

How to be a git. Dominic Mitchell

Submitting your Work using GIT

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

Git Magic: Versioning Files Like a Boss. Tommy MacWilliam

Revision Control. An Introduction Using Git 1/15

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

MOOSE-Based Application Development on GitLab

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

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

Assumptions. GIT Commands. OS Commands

Git tutorial. Katie Osterried C2SM. October 22, 2015

Git, the magical version control

Version Control. Version Control

Git. all meaningful operations can be expressed in terms of the rebase command. -Linus Torvalds, 2015

Git. Presenter: Haotao (Eric) Lai Contact:

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

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

Gitting things done. Hands-on introduction to git niceties. Jan Urbański Ducksboard

Git Introduction CS 400. February 11, 2018

What is git? Distributed Version Control System (VCS); Created by Linus Torvalds, to help with Linux development;

A BASIC UNDERSTANDING OF VERSION CONTROL

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

Version Control: Gitting Started

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

Introduction to Version Control

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

Revision Control and GIT

Introduction, Instructions and Conventions

Lecture 6 Remotes. Sign in on the attendance sheet!

VCS VERSION CONTROL SYSTEMS

Software Development I

Version Control with GIT

Lab Objective. Lab Assignment. Downloads and Installation

Git. Ľubomír Prda. IT4Innovations.

Version Control Systems (Part 1)

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

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

Push up your code next generation version control with (E)Git

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

[Software Development] Development Tools. Davide Balzarotti. Eurecom Sophia Antipolis, France

Github/Git Primer. Tyler Hague

Fundamentals of Git 1

Advanced Operating Systems Control Versioning with GIT. Giuseppe Massari

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

Version Control. Collaborating with git. Tim Frasier

b. Developing multiple versions of a software project in parallel

Visualizing Git Workflows. A visual guide to 539 workflows

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

An Overview of Version Control Systems. Guest lecture Juhan Ernits Computer Systems Engineering

Distributed Version Control (with Git)

Git. (Why not CVS?... because Git.) Karel Zak Florian Festi Bart Trojanowski December 20, 2007

Git Resolve Conflict Using Mine Command Line

E, F. deleteall command, 352 directory structure, 350 export_data method, 353 inline_data method, 353 print_export method, 351 target directory, 351

1. Which of these Git client commands creates a copy of the repository and a working directory in the client s workspace. (Choose one.

RSARTE Git Integration

G E T T I N G S TA R T E D W I T H G I T

AIS Grid School 2015

an introduction to git

Using Git For Development. Shantanu Pavgi, UAB IT Research Computing

Version Control Systems: Overview

Version Control. Version Control

Computer Science Design I Version Control with Git

FEEG Applied Programming 3 - Version Control and Git II

Algorithm Engineering

Git tips. Some tips to use Git.

GIT FOR SYSTEM ADMINS JUSTIN ELLIOTT PENN STATE UNIVERSITY

Version control with Git.

GETTING TO KNOW GIT: PART II JUSTIN ELLIOTT PENN STATE UNIVERSITY

IC Documentation. Release 0.1. IC team

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Gerrit

Review Version Control Concepts

TDDC88 Lab 4 Software Configuration Management

Introduction to Git and Github

Beyond git add/commit/push

Version Control Systems

CPSC 491. Lecture 19 & 20: Source Code Version Control. VCS = Version Control Software SCM = Source Code Management

CS 520: VCS and Git. Intermediate Topics Ben Kushigian

Using Git to Manage Source RTL

CS 320 Introduction to Software Engineering Spring February 06, 2017

Chapter 5. Version Control: Git

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

FAQ Q: Where/in which branch do I create new code/modify existing code? A: Q: How do I commit new changes? A:

GIT VERSION CONTROL TUTORIAL. William Wu 2014 October 7

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)

Managing Network Configurations with Git and GitLab

Source Code Management wih git

USING GIT FOR AUTOMATION AND COLLABORATION JUSTIN ELLIOTT - MATT HANSEN PENN STATE UNIVERSITY

A L A TEX-oriented intro to Git

Transcription:

Git A fast distributed revision control system Nils Moschüring PhD Student (LMU) Nils Moschüring PhD Student (LMU), Git 1

1 The three W s What? Why? Workflow and nomenclature 2 Overview of gits structure Structure Branches 3 Using git Setting up Working Sharing 4 Final stuff Nils Moschüring PhD Student (LMU), Git 2

What is a version control system? A system which monitors data continuously Monitors means that it will detect any changes to the data and will be able to tell you about them. At every point during your work you can tell the system to take a snapshot (a record of the current status of the data). You can let others change your data and these changes will also be recorded. A friend with benefits (on top of the above) Everything is saved with a timestamp and user information (making it easy to pinpoint and blame the source of a mistake). All changes can easily be reverted to any previous state. You can even revert to a previous version, fix an error and automatically redo all the other good stuff! Nils Moschüring PhD Student (LMU), Git 4

Why do I need it? Single User: This functionality greatly simplifies the development process of digital products. Especially the development of software. Multi User: Everybody can change whatever he wants, without consulting anybody else. All the modifications by all the different users will be merged to one final result automatically. If they don t overlap. Different branches are supported.they enable you to work on a specific subproblem separately. Of course, these can later be merged without trouble. If they don t overlap. Nils Moschüring PhD Student (LMU), Git 5

Workflow - Commit Nils Moschüring PhD Student (LMU), Git 6

Workflow - Commit Nils Moschüring PhD Student (LMU), Git 7

Workflow - Checkout Nils Moschüring PhD Student (LMU), Git 8

Workflow - Merge Nils Moschüring PhD Student (LMU), Git 9

Workflow - Branches Nils Moschüring PhD Student (LMU), Git 10

Git is a distributed RCS Nils Moschüring PhD Student (LMU), Git 12

Working Copy - Index - Repository Working Directory Index Repository checkout add reset commit Nils Moschüring PhD Student (LMU), Git 13

Branches How do they work? different versions of the same overall functionality (overlaps) experimental stuff, tryouts parallel development on the same trunk What branches do I have and why: Run git branch -a Git keeps copies of all branches on your source repository marked with a remotes/ prefix. If you run the git fetch command, these local copies will be updated. git fetch makes changes from a different repository available in your repository. You can create new remotes with the git remote command. You can set an alias (as origin in the cloned case). The branches marked as remotes/ can not be checked out. You have to create a local branch which tracks the remote one. Tracking means, that git pull and git push will use these branches as a default. Nils Moschüring PhD Student (LMU), Git 14

Branches - workflow example: new features & multi users Testing V1 V2 V3 branch merge merge Master V1 V2 V3 V4 V5 commits Nils Moschüring PhD Student (LMU), Git 15

Branches - workflow example: different versions microwave V1 V2 V3 branch merge oven V1 V2 V3 V4 V5 branch merge grill V1 V2 V3 Nils Moschüring PhD Student (LMU), Git 16

Using git: Setting up Configuring Git Run: git config --global user.name "Bob" git config --global user.email "bob@bob.com" Setting up a local repository git init Copying (Cloning) an existing repository git clone GIT-URL Possible GIT-URLs (only ssh and local shown): ssh://[user@]host.xz[:port]/path/to/repo.git/ [user@]host.xz:path/to/repo.git/ /path/to/repo.git/ Nils Moschüring PhD Student (LMU), Git 18

Using git: working The git checkout command Checks out a branch: Sets your repository to the last commit of the branch (called the HEAD), sets your index and your working directory to the desired branch data. Important Command line argument: -b Create a new branch and switch to it The git add command Puts local changes into the index on a file by file basis. The git diff command Shows the difference between your working copy and the index. The git status command Shows the current status of your working directory, index and repository. Nils Moschüring PhD Student (LMU), Git 19

Using git: working The git commit command Puts the changes in the index into the repository creating a new checkpoint (commit). Important command line argument: -a Includes adding all changes to the index. -m Followed by a string (use quotes!); Sets this string as the commit message. The git branch command Creates a new branch or shows the existing branches. Important command line arguments: -a Shows all existing branches -d Deletes a branch (verifying that the changes are in the current branch) -D Delete a branch without verifications Example: git branch my_testing remotes/origin/testing Creates a new local branch named my testing which is tracking the branch named testing on the origin repository. Nils Moschüring PhD Student (LMU), Git 20

Using git: working The git merge command Normally you will use it to merge a branch you will abandon back into your main branch. To do that, checkout the main branch and do git merge soon-to-be-abandoned-branch If there are conflicts (the two branches differ in the same line), git will leave conflict markers. They look like this: <<<<<<< master Content of line x in branch master ======= Content of line x in branch local >>>>>>> local Resolve them and commit the result! The gitk command This will show a nice graphical representation of your repository, the branches and their relations. A good alternative for Mac OS X is GitX which can be found on MacPorts. Nils Moschüring PhD Student (LMU), Git 21

Using git: sharing The git pull command Consists of the git fetch and the git merge command as follows The first parameter can be a repository GIT URL. It is used to fetch from. The results are normally stored in the local remotes/remote-alias/ branches. The second parameter is the branch on the foreign repository to be used in the merge command. If you ve set up your tracking branches, git will automatically know all of the above and a git pull without any arguments updates your local branch to the respective branch on the remote repository. This command always modifies the currently checked out branch! Of course this could cause merge conflicts... Nils Moschüring PhD Student (LMU), Git 22

Using git: sharing The git push command Tries to update a branch on a remote repository. Normally works only for fast forwards, i.e. merges with no conflicts (there are good reasons) You can force a push, but if you do, it will NOT do a merge! If the push doesn t work, the normal procedure would be to do a pull first, resolve the problems and then push the new commit, which is then directly descendent from the current status on the repository. Nice feature: hooks You can make interesting things happen to a repository every time you push into it... - http://www.kernel.org/pub/software/scm/git/docs/git-push.html Nils Moschüring PhD Student (LMU), Git 23

Using git: advanced git commands The git rebase command Rewriting of history Squashing of commits Creating a linear history The git grep command Improved searching in repositories Follows the same basic syntax as Unix grep The git stash command Puts your changes to a safe place and resets the working directory and index Handy for quick looks into different branches without having to create a commit Nils Moschüring PhD Student (LMU), Git 24

Using git: advanced git commands, rebase Testing V1 V2 V3 branch merge Master V1 V2 V3 V4 rebase V1 V2 V3 V4 V1 V2 V3 Nils Moschüring PhD Student (LMU), Git 25

Using git: advanced git commands The git rebase command Rewriting of history Squashing of commits Creating a linear history The git grep command Improved searching in repositories Follows the same basic syntax as Unix grep The git stash command Puts your changes to a safe place and resets the working directory and index Handy for quick looks into different branches without having to create a commit Nils Moschüring PhD Student (LMU), Git 26

Final stuff Of course there are many more really useful commands you should use, please discover them on your own. References I used: http://book.git-scm.com/index.html http://www.kernel.org/pub/software/scm/git/docs/git.html Take-Home-Message USE GIT Nils Moschüring PhD Student (LMU), Git 28