Backing up a machine with git

Slides:



Advertisements
Similar presentations
Introduction To GIT Rob Di Marco Philly Linux Users Group July 14, 2008.
Advertisements

om om GIT - Tips & Tricks / git.dvcs git-tips.com
Introduction to git Alan Orth Nairobi, Kenya September, 2010 version control for serious hackers ;)
Patterns & practices Symposium 2013 Introducing Git version control into your team Mark
1 CSE 390 “Lecture 11” Version control with Git slides created by Ruth Anderson, images from
Git for Version Control These slides are heavily based on slides created by Ruth Anderson for CSE 390a. Thanks, Ruth! images taken from
Fundamentals of Git By Zachary Ling 29 th, Aug,
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.
Git. What’s Git? A British swear A Distributed Version Control System Developed in 2005 by Linus Torvalds for use on the Linux Kernel Git Logo by Jason.
Introduction to Version Control with SVN & Git CSC/ECE 517, Fall 2012 Titus Barik & Ed Gehringer, with help from Gaurav.
علیرضا فراهانی استاد درس: جعفری نژاد مهر Version Control ▪Version control is a system that records changes to a file or set of files over time so.
Git A distributed version control system Powerpoint credited to University of PA And modified by Pepper 8-Oct-15.
Version Control Systems academy.zariba.com 1. Lecture Content 1.What is Software Configuration Management? 2.Version Control Systems (VCS) 3.Basic Git.
…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.
Team 708 – Hardwired Fusion Created by Nam Tran 2014.
Introduction to Version Control with Git CSC/ECE 517, Fall 2014 A joint project of the CSC/ECE 517 staff, including Titus Barik, Gaurav Tungatkar, Govind.
Git Super Basics. What is Git? Version Control System (VCS) Successor to SVN in the Drupal eco-system A tool.
1 GIT NOUN \’GIT\ A DISTRIBUTED REVISION CONTROL AND SOURCE CODE MANAGEMENT (SCM) SYSTEM WITH AN EMPHASIS ON SPEED. INITIALLY DESIGNED AND DEVELOPED BY.
GIT.
Intro to Git presented by Brian K. Vagnini Hosted by.
Page 1 TBD 12/08/2014 Formation GIT Laurent Kappel Groupe SII 65, rue de Bercy Paris Tél : Fax :
Лекция 1 Обзор курса и средств разработки. Система поддержки версий GIT ls -la total.
Falcons Git Usage Andre Pool Version 2.0 October 2015 / Veldhoven.
Introduction to Git Yonglei Tao GVSU. Version Control Systems  Also known as Source Code Management systems  Increase your productivity by allowing.
It’s not just an insult from Harry Potter!. What is Git? Distributed Version Control System (DVCS) – Compared to a Centralized Version Control System.
Introduction to Git - Chirag Dani. Objectives Basics of Git Understanding different “Mindset of Git” Demo - Git with Visual Studio.
INTRODUCTION TO GIT. Install Egit for eclipse Open eclipse->Help->Install New Software Search for one of the following -
Git How to 1. Why Git To resolve problems in lab exams (accidental deletions) Use existing Libraries with ease (Statistics and Computer) Prepare undergraduates.
Git A distributed version control system Powerpoint credited to University of PA And modified by Pepper 28-Jun-16.
1 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free-electrons.com Introduction to Git Thomas.
Getting Started with Git Presented by Jim Taylor Rooty Hollow, Owner Verizon Wireless, Senior Programmer/Analyst Git User for 6 years.
Jun-Ru Chang Introduction GIT Jun-Ru Chang
GIT Version control. Version Control Sharing code via a centralized DB Also provides for Backtracking (going back to a previous version of code), Branching.
Git for bzr users October Aurélien Gâteau An attempt at making you comfortable when you have to work with a git repository.
KIT – University of the State of Baden-Wuerttemberg and National Research Center of the Helmholtz Association STEINBUCH CENTRE FOR COMPUTING - SCC
Introduction to Git and git-svn Paul Gier Red Hat Sept. 27, 2011.
Basics of GIT for developers and system administrators
CS5220 Advanced Topics in Web Programming Version Control with Git
Introduction to GitHub
Introduction to Version Control with Git
M.Sc. Juan Carlos Olivares Rojas
L – Modeling and Simulating Social Systems with MATLAB
L – Modeling and Simulating Social Systems with MATLAB
Version Control Systems
11 Version control (part 2)
CReSIS Git Tutorial.
L – Modeling and Simulating Social Systems with MATLAB
SSE2034: System Software Experiment 3 Spring 2016
L – Modeling and Simulating Social Systems with MATLAB
Version Control overview
Version control, using Git
Distributed Version Control with git
Akshay Narayan git up to speed with RCS Akshay Narayan
SIG: Open Week 1: GitHub Tim Choh.
Using Github.
Git CS Fall 2018.
Version Control System - Git
Version control with Git
Introduction to Git and GitHub
Version Control with Git
Version Control with Git and GitHub
Git Fundamentals.
Git Introduction.
Git GitHub.
Introduction to The Git Version Control System
Introduction To GitHub
Introduction To GitHub
Advanced Git for Beginners
Presentation transcript:

Backing up a machine with git St. Louis Unix User's Group 13 April 2016 Lee Lammert Omnitec Corporation SLUUG 13 April 2016

so, what’s git? A distributed revision control system with an emphasis on: Speed Data integrity Support for distributed, non-linear workflows Initially designed and developed in 2005 by Linus Torvalds and the Linux kernel developers SLUUG 13 April 2016

Git is distributed version control system focused on speed, effectivity and real-world usability on large projects. - git-scm.com SLUUG 13 April 2016

git is, .. Directory content management system Tree history storage system A toolkit Stupid content tracker The “plumbing”! SLUUG 13 April 2016

Basic source control system SLUUG 13 April 2016

but why git? SLUUG 13 April 2016

let’s git started SLUUG 13 April 2016

Create a repository $ cd (project-directory) $ git init Initialized empty Git repository in .git/ $ gs On branch master Initial commit nothing to commit (create/copy files and use "git add" to track) SLUUG 13 April 2016

What was that? Being old-school cli, I am a firm believer that the fewer characters the better: alias gs='git status' alias gd='git diff' SLUUG 13 April 2016

Add some files $ touch lee $ touch bob $ touch steve $ gs On branch master Initial commit Untracked files: (use "git add <file>..." to include in what will be committed) bob lee steve nothing added to commit but untracked files present (use "git add" to track) $ git add * SLUUG 13 April 2016

Add them to the repo $ git commit -m "Initial Version" [master (root-commit) a037529] Initial Version 3 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 bob create mode 100644 lee create mode 100644 steve $ gs On branch master nothing to commit, working directory clean SLUUG 13 April 2016

Change something $ gs On branch master Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: lee Untracked files: (use "git add <file>..." to include in what will be committed) lee~ no changes added to commit (use "git add" and/or "git commit -a") $ git commit -m "Initial Version" [master (root-commit) a037529] Initial Version 3 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 bob create mode 100644 lee create mode 100644 steve $ gs On branch master nothing to commit, working directory clean SLUUG 13 April 2016

Need to ignore some files! $ cat .gitignore *~ $ git commit .gitignore -m "Added .gitignore" [master ae5e55b] Added .gitignore 1 file changed, 1 insertion(+) create mode 100644 .gitignore $ gs On branch master Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: lee no changes added to commit (use "git add" and/or "git commit -a") SLUUG 13 April 2016

Look at changes git diff alias gd='git diff' $ gd lee diff --git a/lee b/lee index e69de29..3c73ecc 100644 --- a/lee +++ b/lee @@ -0,0 +1 @@ +This is a changed file! SLUUG 13 April 2016

Two ways to add files Adding a individual file Adding a multiple files $ git add README Adding a multiple files $ git add . SLUUG 13 April 2016

Check the history $ git log commit ae5e55bce726b35f62ae945a2a52705f99ecb5cf Author: L. V. Lammert <lvl@omnitec.net> Date: Wed Apr 13 15:33:51 2016 -0500 Added .gitignore commit a0375291adbae38abb64ffcc15ba67297666cae1 Date: Wed Apr 13 15:28:28 2016 -0500 Initial Version SLUUG 13 April 2016

Configuring the repo $ git config --global user.name "L V Lammert" $ git config --global user.email "lvl@omnitec.net" SLUUG 13 April 2016

So, .. what about this backup thing? git operates in the current directory Unlimited versions, changes, tracking, tags, collaboration uses the repo BUT, a repo is not saved anywhere else! SLUUG 13 April 2016

Local .git directory $ ls -al .git total 24 drwxrwxr-x 8 lvl users 155 Apr 13 15:34 ./ drwxrwxr-x 3 lvl users 77 Apr 13 15:32 ../ drwxrwxr-x 2 lvl users 6 Apr 13 15:19 branches/ -rw-rw-r-- 1 lvl users 17 Apr 13 15:33 COMMIT_EDITMSG -rwxrw-r-- 1 lvl users 92 Apr 13 15:19 config* -rw-rw-r-- 1 lvl users 73 Apr 13 15:19 description -rw-rw-r-- 1 lvl users 23 Apr 13 15:19 HEAD drwxrwxr-x 2 lvl users 4096 Apr 13 15:19 hooks/ -rw-rw-r-- 1 lvl users 328 Apr 13 15:33 index drwxrwxr-x 2 lvl users 20 Apr 13 15:19 info/ drwxrwxr-x 3 lvl users 28 Apr 13 15:28 logs/ drwxrwxr-x 10 lvl users 82 Apr 13 15:33 objects/ drwxrwxr-x 4 lvl users 29 Apr 13 15:19 refs/ SLUUG 13 April 2016

Create a remote copy Setup a keypair for access, and test Init the repo there $ ssh apollo Last login: Wed Apr 13 12:28:39 2016 from marvel.omnitec.net OpenBSD 4.8 (GENERIC) #136: Mon Aug 16 09:06:23 MDT 2010 lvl@Apollo:~ (-bash) $ mkdir SLUUG_Repo $ git init --bare Initialized empty Git repository in /u/lvl/ SLUUG 13 April 2016

Connect your repo Add a remote to the local repo $ git remote add SLUUG apollo:SLUUG_repo $ git remote SLUUG SLUUG 13 April 2016

push local to remote $ git push SLUUG master Counting objects: 6, done. Delta compression using up to 6 threads. Compressing objects: 100% (4/4), done. Writing objects: 100% (6/6), 483 bytes | 0 bytes/s, done. Total 6 (delta 0), reused 0 (delta 0) To apollo:SLUUG_Repo * [new branch] master -> master $ git push SLUUG master Counting objects: 6, done. Delta compression using up to 6 threads. Compressing objects: 100% (4/4), done. Writing objects: 100% (6/6), 483 bytes | 0 bytes/s, done. Total 6 (delta 0), reused 0 (delta 0) To apollo:SLUUG_Repo * [new branch] master -> master SLUUG 13 April 2016

more git uses Undoing changes Checkout a specific version $ git checkout lee $ git checkout 3607253d20c7a295965f798109f9d4af0fbeedd8 <file name> SLUUG 13 April 2016

developing parallel with branching

create a branch $ git checkout -b bugfix Switched to a new branch “bugfix”

switching branches $ git status $ git checkout master # On branch bugfix nothing to commit (working directory clean) $ git checkout master Switched to branch “master”

collaborating with git

public repos = free private repos = cheap

clone a hosted repository $ git clone git://github.com/git/hello-world.git Initialized empty Git repository in /Users/me/Projects/hello-world/.git/ remote: Counting objects: 158, done. remote: Compressing objects: 100% (79/79), done. remote: Total 158 (delta 54), reused 157 (delta 54) Receiving objects: 100% (158/158), 15.62 KiB, done. Resolving deltas: 100% (54/54), done. $ cd hello-world

pull changes (and pull often) $ git pull origin master

add changes to master $ git checkout master $ git merge bugfix

push changes $ git push origin master

configure & customize git

add pretty colors $ git config --global color.diff auto $ git config --global color.status auto $ git config --global color.branch auto

git tools

gitk

GitX

TortoiseGit

git resources

Pro Git (book)

Pragmatic Version Control Using Git (book)

Git Community Book

Git Cheat Sheet

what to remember commit often pull often use checkout and reset with caution create your own repository anywhere

fin

linkedin.com/in/erincarter illustrations by Simon Oxley of idokungfood.com theme inspired by Scott Chacon’s git-scm.com