GIT FOR SYSTEM ADMINS JUSTIN ELLIOTT PENN STATE UNIVERSITY

Similar documents
Git! Fundamentals. IT Pro Roundtable! June 17, 2014!! Justin Elliott! ITS / TLT! Classroom and Lab Computing!! Michael Potter!

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

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

Software Project (Lecture 4): Git & Github

Algorithm Engineering

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.

Version Control. Version Control

Software Development I

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

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

Introduction to Version Control using Git

Git. Presenter: Haotao (Eric) Lai Contact:

Assumptions. GIT Commands. OS Commands

Fundamentals of Git 1

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

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

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

GETTING STARTED WITH. Michael Lessard Senior Solutions Architect June 2017

Git for Newbies. ComMouse Dongyue Studio

Barry Grant

Introduction to distributed version control with git

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

Computer Science Design I Version Control with Git

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

Using Git to Manage Source RTL

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

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

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

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

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

Version Control: Gitting Started

Git Introduction CS 400. February 11, 2018

CS 520: VCS and Git. Intermediate Topics Ben Kushigian

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

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

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

Windows. Everywhere else

Git Tutorial. André Sailer. ILD Technical Meeting April 24, 2017 CERN-EP-LCD. ILD Technical Meeting, Apr 24, 2017 A. Sailer: Git Tutorial 1/36

Git Workflows. Sylvain Bouveret, Grégory Mounié, Matthieu Moy

Version Control. Version Control

Revision Control. An Introduction Using Git 1/15

Software Revision Control for MASS. Git Basics, Best Practices

Lab Exercise Git: A distributed version control system

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

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

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

Introduction to Version Control

Lab Objective. Lab Assignment. Downloads and Installation

Git, the magical version control

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

Git for Version Control

Git: Distributed Version Control

Managing Network Configurations with Git and GitLab

Beyond git add/commit/push

Submitting your Work using GIT

Version Control Systems

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

Version control with git and Rstudio. Remko Duursma

Git version control with Eclipse (EGit) Tutorial

1. Git. Robert Snapp

CS 320 Introduction to Software Engineering Spring February 06, 2017

Getting started with GitHub

Basic git. Interactive.

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

Working with GIT. Florido Paganelli Lund University MNXB Florido Paganelli MNXB Working with git 1/47

AIS Grid School 2015

Version control with Git.

CS 390 Software Engineering Lecture 4 - Git

DEVNET Introduction to Git. Ashley Roach Principal Engineer Evangelist

Version Control. Second level Third level Fourth level Fifth level. - Software Development Project. January 11, 2017

Introduction to Git and Github

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

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

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

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

Using git to download and update BOUT++

Version control system (VCS)

Chapter 5. Version Control: Git

From Commits to Collaboration: A Git Tutorial for Social Scientists

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

Revision control. INF5750/ Lecture 2 (Part I)

FEEG Applied Programming 3 - Version Control and Git II

Git: Distributed Version Control

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

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

Git Basi, workflow e concetti avanzati (pt2)

Improving Your Life With Git

CSE 391 Lecture 9. Version control with Git

CSCI 2132: Software Development. Norbert Zeh. Faculty of Computer Science Dalhousie University. Subversion (and Git) Winter 2019

VCS VERSION CONTROL SYSTEMS

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

Salvatore Rinzivillo VISUAL ANALYTICS

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

Laboratorio di Programmazione. Prof. Marco Bertini

L Modeling and Simulating Social Systems with MATLAB

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

GIT VERSION CONTROL TUTORIAL. William Wu 2014 October 7


Version Control with Git

Transcription:

GIT FOR SYSTEM ADMINS JUSTIN ELLIOTT PENN STATE UNIVERSITY 1

WHAT IS VERSION CONTROL? Management of changes to documents like source code, scripts, text files Provides the ability to check documents in and out of a versioning system Version Control System (VCS) Source Code Management (SCM) 2

WHY SHOULD YOU USE IT? Enables you to easily back out of mistakes Removes the risk of updating your scripts and code Excellent for collaboration with others Greatly enhances your ability to be agile and move quickly with scripts and coding. 3

GIT VERSUS SUBVERSION Lightning fast! Checkouts are MUCH faster Clients have the full repo Distributed versus centralized No need for constant network access Easier to ignore files and edit other properties Git easily handles renaming and moving files Branching and Merging is much easier in Git 4

GIT: A GREAT SCM TOOL Extremely fast performance Excellent data integrity Git checksums everything (SHA-1) Easy to learn and start small 5

GIT OVERVIEW Git is distributed All clients have the full repo Changes are applied to local repo first Backups are everywhere Each member of your team has a local copy 6

GIT TERMINOLOGY Repository Working Directory Staging Area Remote 7

GIT FILE CLASSIFICATIONS Tracked Already in the repo, Git is watching it Ignored Can exist locally, not in repo and git ignores it Untracked What's not tracked or ignored 8

GIT FILE STATES Modified Is tracked, changed but not yet committed Staged Modified filed marked to go into next commit Committed Safely stored in the repo 9

BASIC GIT WORKFLOW Working Directory Staging Area Repository 10

HOW TO INSTALL GIT Download from http://git-scm.com/ downloads OS X: Terminal.app Windows: Git Bash Embedded with many Git GUI client apps 11

CONFIGURING GIT $ git config Contains items such as name, email, editor, diff tool 12

CONFIGURE LINE ENDINGS End of line characters differ based on client OS OS X and Linux use one invisible character LF (Line Feed) Windows uses two invisible characters CR (Carriage Return) + LF (Line Feed) Embrace the native line endings for each OS 13

LINE ENDING MODES core.autocrlf true Use for cross platform projects on Windows clients core.autocrlf input Use for cross platform projects on OS X clients core.autocrlf false Use only on single platform projects 14

LINE ENDINGS ON OS X Enable auto convert CRLF to LF: 15

LINE ENDINGS ON WINDOWS Enable auto convert to LF on Windows by using git config to set core.autocrlf to true: 16

CREATE A REPOSITORY $ git init ProjectName.git Initializes a new and clean repository in new directory $ git clone <repourl> <directory> The process of copying an existing Git repository locally to your computer Copies the entire repository history and file revisions 17

STATUS OF FILE CHANGES How do I know what has changed? $ git status Status reports different states Untracked Modified Staged 18

IGNORING FILES Some files should never reside in the repo The.gitignore file solves this Specify file names, directory paths to ignore Supports Wildcards *NotForRepo*, *.dmg 10.9.4-Lab-Image.dmg LargeDataFile-NotForRepo.db 19

ADDING FILES THE REPO Adding files are staged Why not just directly commit the changes? git add -v <file/folder_name> git add -v. git add -A 20

UNSTAGING FILES File not yet tracked but staged: $ git rm --cached NewFile.txt Files already tracked in repo, revert to previous $ git reset HEAD FileName.txt 21

COMMITTING CHANGES This process saves the revisions made to the repository Commit often - You will thank yourself later! Or else Larger changes are much harder to pick apart and revert back to! Each commit should encapsulate a single fix* $ git commit -m <commit_message> 22

VIEWING DIFFS Commits are all about what is different Viewing the differences $ git diff <FileName> GUI Apps Kaleidoscope, FileMerge, Changes.app, etc. 23

VIEWING COMMIT LOGS $ git log $ git log -p -2 Lists changes in last two commit entries 24

BRANCHES master is the default branch Merging of branches is where Git excels Help to separate lines of development Git Flow is a popular branching model Ex: Master, Hotfix, Development, Feature, Release 25

BRANCHES $ git checkout master Create and switch to new branch $ git checkout -b <branch> Delete branch $ git branch -d <branch> 26

HEAD REFERENCE HEAD is a reference to latest commit in branch OR a specific commit What does "detached HEAD" mean, and why should I care? Occurs when you check out a specific commit in a branch versus the latest commit of branch 27

COMMAND LINE DEMO Create Repo Create.gitignore Add Files Review Logs View Diffs Checkout commit Commit Changes 28

REMOTE REPOS Local repo on your client only Remote is a Git host to push to You clone from remotes 29

REMOTE REPOS Network Based SSH HTTPS Git Protocol (daemon) 30

SELF-HOSTED REPOS SSH Enable SSH, create bare repository on server Atlassian Stash Enterprise GitHub GitLab 31

REMOTE REPOS 3rd Party GitHub, BitBucket, Google Code CodeSpaces, SourceRepo Assembla, Gitorious git.psu.edu (For Penn Staters) And possibly more, I m sure 32

CLONING A REPOSITORY The process of copying an existing Git repository to your computer A cloned repo includes the entire file history changes and commit messages Git clone command example: $ git clone https://server.edu/reponame.git 33

PUSHING CHANGES $ git push origin master Push (upload) the master branch to the origin remote host 34

GUI CLIENTS http://git-scm.com/downloads/guis GitHub (OS X and Windows) SourceTree (OS X and Windows) Tower (OS X) 35

BASICS OF GITHUB DEMO Create Repo Create.gitignore Add Files Commit View Diffs Review Logs 36

SOURCETREE Integrated support for Git hosting services GitHub, BitBucket, Kiln, Stash Helps to simplify more complex tasks Decent UI 37

SOURCETREE DEMO Create repo Create.gitignore Add files Commit changes Review Logs View Diffs Create Branch Merge Branch 38

LESSONS LEARNED Start small Pick just one project to manage with Git Use remotes when ready GitHub, BitBucket, SSH host 39

LESSONS LEARNED Take the time to write good commit messages There will be a time when you need to search your commit messages and it will really help you out Be nice to your future self Where / when / how did I fix that issue? 40

GIT COMMAND LINE HELP $ git help $ git help <command> 41

RESOURCES AND TRAINING Official Git Site http://git-scm.com Git Cheat Sheets Git Pro Book 42

RESOURCES AND TRAINING http://try.github.com http://atlassian.com/git O Reilly McCullough and Berglund on Mastering Git 43

Q & A Justin Elliott jelliott [at] psu.edu! @justindelliott 44

THANK YOU. Justin Elliott jelliott [at] psu.edu! @justindelliott 45