Git - An Introduction

Post on 25-Jul-2015

28 views 2 download

Tags:

transcript

Git An Introduction

K. ARVIND Overture Networks

December 2013

DRAWS LIBERALLY FROM VARIOUS ONLINE RESOURCES, ESPECIALLY SCOTT CHACON’s EXCELLENT BOOK ON GIT

● What is Git?

● How is Git different?

● Giit conceptual overview

○ Hashes, Repository, Branching

Plan

• Distributed Version Control System

• Linux Community

• 2005

What is Git?

● Single server that contains versioned files

● Clients have version being worked on

● Easy to administer

● Single point of failure

● Need connectivity to commit

● Subversion, CVS, Perforce

Centralized VCS

Distributed VCS

● Every client has the full repository

● Central repository may also be used

● Local commits followed by push

● Fault Tolerant

● Work off-line

Why Git?

● Fast

● Simple

● Branching

● Fully distributed

● Scales well

No Deltas!

Dog ate cable - No problem!

Nearly every operation is local!

Name is a Digest

Git object name = SHA-1 hash of contents

Built-in integrity check

Cryptographic Digest

Commit Hash: Git Bash SOME PROPRIETARY INFORMATION REDACTED BELOW

Digest “uniqueness” is “real”! SOME PROPRIETARY INFORMATION REDACTED BELOW

Commit Hash - Gitk SOME PROPRIETARY INFORMATION REDACTED BELOW

Commit Hash: TortoiseGit SOME PROPRIETARY INFORMATION REDACTED BELOW

Git Objects

Commit History

Git Repository

Git Repository

Git repository

Branch - Pointer to a commit

● HEAD - points to current branch

● master - default branch

No branches added

Add a branch

gitbash> git branch testing f30ab

HEAD still points to master

Switch to branch

gitbash> git checkout testing

HEAD has moved to testing

Commit on branch

testing points to new commit

HEAD still points to testing

Switch back to master branch

gitbash> git checkout master

HEAD points to master now

Commit on master

Diverging branches - need to merge

later

Merge

gitbash> git merge iss53

Preferred alternative: git rebase

Pulling remote branches

Conclusion

● Conceptual overview

● Many key concepts

● Free resources available online for further

study:

● ProGit by Scott Chacon - http://git-scm.com/book

Thank you Scott Chacon!