Git. Presenter: Haotao (Eric) Lai Contact:

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

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

Beyond git add/commit/push

Computer Science Design I 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

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

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

Version Control System - Git. zswu

Revision control Advanced git

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

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

VCS VERSION CONTROL SYSTEMS

Submitting your Work using GIT

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

Git, the magical version control

Git for Subversion users

Version Control: Gitting Started

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

CS 390 Software Engineering Lecture 5 More Git

Software Development I

Git tutorial. Katie Osterried C2SM. October 22, 2015

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

Version control with Git.

CS 520: VCS and Git. Intermediate Topics Ben Kushigian

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:

CSE 391 Lecture 9. Version control with Git

CS 390 Software Engineering Lecture 4 - Git

git-flow Documentation

Version Control with GIT

Improving Your Life With Git

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

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

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

Git for Version Control

Advanced Operating Systems Control Versioning with GIT. Giuseppe Massari

A BASIC UNDERSTANDING OF VERSION CONTROL

Assumptions. GIT Commands. OS Commands

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

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

Use git rm to remove files from workspace

Git(Lab) Tutorial and Hands-On

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

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

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

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

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


GIT FOR SYSTEM ADMINS JUSTIN ELLIOTT PENN STATE UNIVERSITY

GETTING STARTED WITH. Michael Lessard Senior Solutions Architect June 2017

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

Introduction to Version Control with Git

Introduction to distributed version control with git

GIT CHEAT SHEET. CONFIG --global => write to ~/.gitconfig, otherwise to.git/config. git config [--global] -l git config [--global] -e

Version Control with Git

GIT VERSION CONTROL TUTORIAL. William Wu 2014 October 7

Version control system (VCS)

KTH Royal Institute of Technology SEMINAR 2-29 March Simone Stefani -

Software Project (Lecture 4): Git & Github

DEVNET Introduction to Git. Ashley Roach Principal Engineer Evangelist

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

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

Managing Network Configurations with Git and GitLab

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

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

Introduction, Instructions and Conventions

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

Git Introduction CS 400. February 11, 2018

The Old World. Have you ever had to collaborate on a project by

Fundamentals of Git 1

Version control with git and Rstudio. Remko Duursma

Git version control with Eclipse (EGit) Tutorial

תוכנית יומית לכנס התכנסות וארוחת בוקר

1. Git. Robert Snapp

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

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

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

Online Remote Repositories

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

Git for Newbies. ComMouse Dongyue Studio

GIT for companies Mark Struberg, INSO TU Vienna

a handful of Git workflows for the agilist steven harman twitter: stevenharman

Tutorial 2 GitHub Tutorial

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

Algorithm Engineering

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

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

Chapter 5. Version Control: Git

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

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

Using Git to Manage Source RTL

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

Software Engineering

Introduction to Version Control using Git

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

MOOSE-Based Application Development on GitLab

Revision control. INF5750/ Lecture 2 (Part I)

Lecture 6 Remotes. Sign in on the attendance sheet!

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

Git & Github Fundamental by Rajesh Kumar.

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

Transcription:

Git Presenter: Haotao (Eric) Lai Contact: haotao.lai@gmail.com 1

Acknowledge images with white background is from the following link: http://marklodato.github.io/visual-git-guide/index-en.html images with transparent background is from a book named Pro Git : https://git-scm.com/book/en/v2 images in the workflow section is from the atlassian git tutorial: https://www.atlassian.com/git/tutorials 2

History ------ from wiki 3

Setting up a repository git init, git clone, git config 4

Preparation I assume you already know how to install it. First time you use it, need to do some configuration job. config (in a Mac): /etc/gitconfig, --system ~/.gitconfig, --global specific_git_repo/.git/config $ git config --global user.name Eric Lai" $ git config --global user.email haotao.lai@gmail.com 5

Get / Create a Git Repository get a repo from a remote server like GitHub or Bitbucket you need to use git clone [remote-url] [local-path] command create a local Git repo you need to use git init command in the working directory you can find a directory in any Git repo named.git/, that s the place all the magic happened 6

Saving changes git add, git commit, git stash,.gitignore 7

File Status Lifecycle 8

Three Areas 7

Git Stage Area add file into stage area use git add file_name command 10

Remove File remove file from working directory use git rm file_name command remove file only from version control system (don t trace them anymore) use git rm --cached file_name command 11

Check Difference 12

Take a Snapshot (1) save a version of your work use git commit command git commit m commit message (put commit message in a line) git commit (vim will be opened to ask you input commit message) every time you commit a version, you have a chance to come back 13

Take a Snapshot (2) image from: http://marklodato.github.io/visual-git-guide/index-zh-cn.html 14

Temporary save your work Need to jump to other emergency work immediately, but haven t finish your current work use git stash command Get my work back use git stash pop or git stash apply But, by default Git will NOT stash the untracked files or ignore files. 15

Inspecting a repository git status, git log 16

Undo changes git checkout, git revert, git reset, git clean 17

Checkout git checkout <commit> git checkout <commit> <file> git checkout <branch> checkout file from history or stage area switch between branch 18

Revert vs. Reset revert: using a new commit to undo the previous commit git revert <commit> reset: when you undo with git reset(and the commits are no longer referenced by any ref or the reflog), there is no way to retrieve the original copy it is a permanent undo. git reset <commit> 19

Clean The git clean command removes untracked files (DANGEROUS!!!) from your working directory. 20

Collaborating 21

Remote Repository (1) git remote add <remote_repo_name> <URL> git remote -v git remote rm <remote_repo_name> git remote rename <old_name> <new_name> 22

Remote Repository (2) git push [remote_repo_name] [branch_name] push your local data to the remote repo something different when you first push, follows the tips provided by Git git pull something like git fetch && git merge git fetch [remote_repo_name] get all data from the remote repo will NOT do any merge for you (unlike git pull) 23

Tag (1) when you have an important version of data (like a release version), you would like to give a tag for that version, so that you can find it easily with using the SHA number git tag (list all tags) git tag -a v1.4 -m 'my version 1.4 (an annotated tag example) git tag <tag_name> (a lightweight version tag) git tag -a v1.2 9fceb02 (add a tag to a previous commit) 24

Tag (2) tag will NOT be pushed to remote repo git push <remote_repo_name> <tag_name> (push a tag) git push <remote_repo_name> --tag (push all tags) you can t move the HEAD between tags, if you want to switch back to a tag, you can create a branch to hold the data in that tag git checkout -b [branch_name] [tag_name] be careful if you want to change the content of that tag 25

Branch --- that s what make Git powerful list all branches: git branch create a new branch: git branch <branch_name> create and switch that branch git checkout -b <branch_name> switch between two existed branches: git checkout <branch_name> merge a target branch into current branch: git merge <target_branch_name> 26

Branch Management list all merged branch (usually they can be deleted) git branch --merged (same story with --no-merged) git branch -d <branch_name> (only work for merged branch) delete anyway (force delete) git branch -D <branch_name> 27

Branch: merge, rebase merge rebase images from a book: Git Pro 28

Branch Warning do NOT rebase any thing already in the remote repo only can apply rebase command to your local data 29

WorkFlow Centralized Workflow, Feature Branch Workflow, Gitflow Workflow, Forking Workflow 30

Centralized Workflow 31

Feature Branch Workflow 32

Gitflow Workflow 33

Forking Workflow 34

Resources A well maintained list of resources related to Git on GitHub, check it through the following link: https://github.com/dictcp/awesome-git 35