Introduc)on to Version Control with Git. Pradeep Sivakumar, PhD Sr. Computa5onal Specialist Research Compu5ng, NUIT



Similar documents
Version control with GIT

Version Control with Git. Linux Users Group UT Arlington. Rohit Rawat

Version Control with Git. Kate Hedstrom ARSC, UAF

MATLAB & Git Versioning: The Very Basics

FEEG Applied Programming 3 - Version Control and Git II

Version Control with Svn, Git and git-svn. Kate Hedstrom ARSC, UAF

Introduction to Version Control with Git

Version Control! Scenarios, Working with Git!

Work. MATLAB Source Control Using Git

Version Control using Git and Github. Joseph Rivera

Git Basics. Christopher Simpkins Chris Simpkins (Georgia Tech) CS 2340 Objects and Design CS / 22

Version Control with Git

Version Control with Git. Dylan Nugent

Version Control. Version Control

Introduction to Version Control

Using Git for Project Management with µvision

Introduction to the Git Version Control System

Version control. HEAD is the name of the latest revision in the repository. It can be used in subversion rather than the latest revision number.

MOOSE-Based Application Development on GitLab

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

Two Best Practices for Scientific Computing

Version control. with git and GitHub. Karl Broman. Biostatistics & Medical Informatics, UW Madison

Introduction to Git. Markus Kötter Notes. Leinelab Workshop July 28, 2015

Version Control with. Ben Morgan

Data management on HPC platforms

Git - Working with Remote Repositories

Revision control systems (RCS) and

Source Control Systems

Introduction to Version Control with Git

Lab Exercise Part II: Git: A distributed version control system

Annoyances with our current source control Can it get more comfortable? Git Appendix. Git vs Subversion. Andrey Kotlarski 13.XII.

Backing Up Your System With rsnapshot

The Linux System. o Updating without touching the user's files and configurations.

Version Control with Git

Git. A Distributed Version Control System. Carlos García Campos carlosgc@gsyc.es

Using GitHub for Rally Apps (Mac Version)

Distributed Version Control with Mercurial and git

An Introduction to Mercurial Version Control Software

Working Copy 1.4 users manual

1. Product Information

Online Backup Client User Manual Linux

Mercurial. Why version control (Single users)

Introweb Remote Backup Client for Mac OS X User Manual. Version 3.20

Version Control Systems

Advanced Computing Tools for Applied Research Chapter 4. Version control

Source Code Management for Continuous Integration and Deployment. Version 1.0 DO NOT DISTRIBUTE

An Introduction to Git Version Control for SAS Programmers

Online Backup Client User Manual

Introducing Xcode Source Control

Continuous Integration. CSC 440: Software Engineering Slide #1

Git Fusion Guide August 2015 Update

Git Basics. Christian Hanser. Institute for Applied Information Processing and Communications Graz University of Technology. 6.

CSE 374 Programming Concepts & Tools. Laura Campbell (Thanks to Hal Perkins) Winter 2014 Lecture 16 Version control and svn

Local Caching Servers (LCS) February 2015

RecoveryVault Express Client User Manual

Subversion. Nadir SOUALEM. Linux Users subversion client svn or higher. Windows users subversion client Tortoise 1.6.

Pro Git. Scott Chacon *

Distributed Version Control

CS197U: A Hands on Introduction to Unix

Online Backup Linux Client User Manual

Online Backup Client User Manual

ALERT installation setup

Version Control Systems: SVN and GIT. How do VCS support SW development teams?

Step One: Installing Rsnapshot and Configuring SSH Keys

Version Uncontrolled! : How to Manage Your Version Control

FileCruiser Backup & Restoring Guide

CS 2112 Lab: Version Control

A Git Development Environment

Acronis Backup & Recovery 10 Server for Linux. Update 5. Installation Guide

CPSC 491. Today: Source code control. Source Code (Version) Control. Exercise: g., no git, subversion, cvs, etc.)

Version Control Script

PKI, Git and SVN. Adam Young. Presented by. Senior Software Engineer, Red Hat. License Licensed under

Putting It All Together. Vagrant Drush Version Control

An Introduction to Mercurial Version Control Software

Cloud Attached Storage

Source Control Guide: Git

CSCB07 Software Design Version Control

SourceAnywhere Service Configurator can be launched from Start -> All Programs -> Dynamsoft SourceAnywhere Server.

Version Control for Computational Economists: An Introduction

DevShop. Drupal Infrastructure in a Box. Jon Pugh CEO, Founder ThinkDrop Consulting Brooklyn NY

Version Control Tools

Gitflow process. Adapt Learning: Gitflow process. Document control

Software configuration management

Version Control Tutorial using TortoiseSVN and. TortoiseGit

Attix5 Pro Server Edition

How To Install Acronis Backup & Recovery 11.5 On A Linux Computer

Acronis Backup & Recovery 10 Server for Linux. Installation Guide

Using Time Machine to Backup Multiple Mac Clients to SNC NAS and 1000

Unity Version Control

What Does Tequila Have to Do with Managing Macs? Using Open Source Tools to Manage Mac OS in the Enterprise!

Zero-Touch Drupal Deployment

Incremental Backup Script. Jason Healy, Director of Networks and Systems

How to Create a Free Private GitHub Repository Educational Account

Version Control. Luka Milovanov

Xcode Source Management Guide. (Legacy)

Transcription:

Introduc)on to Version Control with Git Pradeep Sivakumar, PhD Sr. Computa5onal Specialist Research Compu5ng, NUIT

Contents 1. What is Version Control? 2. Why use Version control? 3. What is Git? 4. Create a repository 5. Branching and Merging 6. Sharing Work 7. Inspec5ng Changes with Diffs 8. References

What is a Version Control System (VCS)? Database to track the history of a file or a collec5on of files Snapshot can save a version of a project at any 5me. Gives the ability to revert to an earlier version VCS can display differences from the previous version

Why use a Version Control System (VCS)? Collabora5on Storing versions properly Restoring previous versions Backup Understanding/Tracking changes

Version Control System Reference: vogella.com

What is Git? Distributed version control system. Each person has a full copy (clone) of the repository. Every clone has the same func5onality. Reference: vogella.com

The Basic Workflow Repository: Database where VCS stores all versions and metadata local : resides on a local computer as a.git folder remote: resides on a remote server. common base to merge changes. Commit Permanently add files to Git repository Creates a new snapshot

Installa)on Windows h\p://msysgit.github.io/ Mac OS h\ps://code.google.com/p/git- osx- installer/downloads/ list?can=3 Linux yum install git (Fedora, Red Hat) sudo apt-get install git (Ubuntu, Debian)

Configure Git Setup user sedngs $ git config --global user.name "John Doe $ git config --global user.email john@doe.org $ git config --global color.ui auto

How to create a local repository Local repo is created by either cloning a remote repo or ini5alizing an exis5ng project. Star5ng with an unversioned project $ git init Making the first commit $ git add -A $ git commit -m Initial Commit

Cloning a remote project Star5ng with an exis5ng project on a server Clone an open project to make a complete copy to local disk. (h\p, h\ps, SSH) $ git clone psi391@quest.it.northwestern.edu:/home/psi391/hpl-2.1/.git $ git clone https://github.com/gittower/git-crash-course.git SSH, h\ps protocols require a password Each clone is a complete copy with permission to change, create, delete, move, copy, or rename files

Working on a project Working tree Collec5on of files in a repository. If a working tree is modified, the changes need to be added to Git. Staging area Place to store changes in the working tree before the commit Reference: vogella.com

CommiEng changes to Git Get an overview of changes to the project: git status Provides a (verbose) summary of what will be commi\ed Update what will be commi\ed git add/rm <file> Commidng your work git commit -m comment Display project history git log

Best Prac)ces Never commit a half finished project For temporary changes, Git s Stash feature is handy Do not commit files from different projects to the same version Test your changes before commidng and finally, good commen5ng (descrip5ve message for changes) makes a big difference

Branches Created from exis5ng project in Git Each branch (full copy) can be modified independently of its predecessor and other branches One of Git s most powerful features Used in developmental workflows: new features, bug fixes, tes5ng, development, and produc5on.

Working with Branches Create a new branch $ git branch testing Checkout branch and go to the new branch $ git checkout -b contact-form The HEAD pointer points to the current working directory Reference: git- tower.com

Merging Changes Checkout the branch that should receive changes (Target) Merge with the name of the branch with the desired changes. $ git checkout master $ git merge branch1 Merge conflicts: If the same part of a file was modified in different ways, Git won t be able to combine changes.

Sharing work Git allows users to sync local repo with remote repo. A remote repo that doesn t have a working directory is called a bare repo Reference: git- tower.com

Remote Repositories Connec5ng to a remote repo $ git remote add <remote-connection> <remote-repo> Connec5on establishes a rela5onship, but doesn t exchange data Update informa5on about specified remote connec5on $ git fetch <remote-connection> Create a local branch based on the remote branch pointer $ git checkout --track <remote-connection/branch> Upload all new commits from current local HEAD branch to its remote counterpart $ git push <remote-connection> <remote-connection/branch>

Integra)ng Remote Changes To obtain a log of remote changes, inspect them $ git fetch origin $ git log origin/master Integrate these changes into the working copy $ git pull

Diffs - Inspec)ng Changes To see the difference between two branches $ git diff master local_branch To see which author modified a file on a per line basis $ git blame -L 1,2 [filename] To see which changes have been staged $ git diff --cached

Reading Diffs Reference: git- tower.com

Advantages of using Git Granularity In a shared workflow, there is a dis5nc5on between making a change and publishing it Makes offline development possible Data redundancy and replica5on Mul5ple copies on mul5ple machines when compared to a centralized version control system Proper5es such as ignore, stash, staging makes it easier to manage workflows Ability to undo/amend commits

References Git Tower, Learn Version Control with Git. Retrieved from h\p://www.git- tower.com/learn/ebook/command- line/introduc5on Lars Vogel, Git - Tutorial. Retrieved from h\p://www.vogella.com/tutorials/git/ar5cle.html