introduction to git

27
INTRODUCTION TO GIT Presented by: Muhammad Rizwan Arshad (PSE) VTeams Presented at: Nextbridge LHR C1 February 28, 2013

Upload: quiana

Post on 23-Feb-2016

59 views

Category:

Documents


0 download

DESCRIPTION

Introduction To Git. Presented by: Muhammad Rizwan Arshad (PSE) VTeams. Presented at: Nextbridge LHR C1. February 28, 2013. Version Control. System that records changes to a file or set of files over time You can recall specific versions later - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Introduction To  Git

INTRODUCTION TO GIT

Presented by:Muhammad Rizwan Arshad

(PSE) VTeams

Presented at:Nextbridge LHR C1

February 28, 2013

Page 2: Introduction To  Git

Version Control

• System that records changes to a file or set of files over time

• You can recall specific versions later• Any type of file on a computer can be placed

under version control.• Version Control Systems– Local Version Control Systems– Centralized Version Control Systems– Distributed Version Control Systems

Page 3: Introduction To  Git

Local Version Control Systems

Page 4: Introduction To  Git

Centralized Version Control Systems

Page 5: Introduction To  Git

Distributed Version Control Systems

Page 6: Introduction To  Git

Git Vs Subversion

• Distributed vs Centeralized.• Git is incredibly fast and small as well.• Branches are even cheaper than they are in

Subversion.• Branch merging is simpler and more automatic in

Git.• Creating a repository is a trivial operation in Git.• The repository's internal file formats are incredible

simple in Git.

Page 7: Introduction To  Git

How Git works?

• Snapshots, Not Differences• Nearly Every Operation Is Local• Git Has Integrity• Git Generally Only Adds Data

Page 8: Introduction To  Git

The Three States

Page 9: Introduction To  Git

First-Time Git Setup

• git config --global user.name “myname“• git config --global user.email

[email protected]• git config --global core.editor emacs• git config --global merge.tool vimdiff• git config --list user.name=“myname”• git config user.name

Page 10: Introduction To  Git

Getting a Git Repository

• git init• git add *.c• git add README• git commit -m 'initial project version‘• Clone a Repository:– git clone git://github.com/schacon/grit.git mygrit

Page 11: Introduction To  Git

File Status Life Cycle

Page 12: Introduction To  Git

Recording Changes to the Repository

• Checking the Status of Your Files– git status

• Tracking New Files– git add README

• Ignoring Files– Edit .gitignore file

• Committing Your Changes– git commit– git commit -m "Story 182: Fix benchmarks for speed"

Page 13: Introduction To  Git

Viewing the Commit History

• git log• git log -p -2• git log –stat• git log --pretty=oneline• git log --since=2.weeks• Using a GUI to Visualize History– gitk

Page 14: Introduction To  Git
Page 15: Introduction To  Git

What a Branch Is• A lightweight movable pointer• Default branch name is MASTER• What happens when you create a new commit ?

Page 16: Introduction To  Git

What a Branch Is• Command “git branch testing”• How does Git know what branch you’re currently on?

Page 17: Introduction To  Git

What a Branch Is• Switch to an existing branch• Command “git checkout testing”

Page 18: Introduction To  Git

What a Branch Is• What is the significance of that? Well, let’s do another commit• Command “git commit -a -m 'made a change‘”

Page 19: Introduction To  Git

What a Branch Is• Let’s switch back to the master branch• Command “git checkout master”

Page 20: Introduction To  Git

What a Branch Is

• Command “git commit -a -m 'made other changes‘”

Page 21: Introduction To  Git

What a Branch Is

Page 22: Introduction To  Git

Basic Branching and Merging

Have a couple of commits already

• you’re going to work on issue #53• Is it issue-tracking system• Create a new branch• Command: git checkout –b iss53• That is shorthand command

Page 23: Introduction To  Git

Basic Branching and Merging

git commit -a -m 'added a new footer [issue 53]'

• git checkout -b hotfix• git commit -a -m 'fixed the broken email address‘• git checkout master

Page 24: Introduction To  Git

Basic Branching and Merging

• git merge hotfix• git branch -d hotfix

• git checkout iss53• git commit -a -m 'finished the new footer [issue 53]‘• git checkout master• git merge iss53

Page 25: Introduction To  Git

Basic Branching and Merging

Page 26: Introduction To  Git

Conflict Handling

Page 27: Introduction To  Git

QUESTIONS?