+ All Categories
Home > Software > Git introduction

Git introduction

Date post: 15-Jul-2015
Category:
Upload: dimitar-danailov
View: 443 times
Download: 0 times
Share this document with a friend
Popular Tags:
76
Git Introduction @d_danailov
Transcript

Topics Today

● What is Git ?● Git Init● Git Branches● Git Merging● Git Conflicts

What is Git ?

Git is an open source, distributed version control

system designed for speed and efficiency

Git is an open source, distributed version control

system designed for speed and efficiency

Git is an open source, distributed version control system designed for speed

and efficiency

Centralized source controlvs

distributed version control

Centralized source control

Computer A

Checkout

File

Central VSC Server

Version Database

Version 3

Version 2

Version 1

Computer A

Checkout

File

Central VSC Server

Version Database

Version 3

Version 2

Version 1

Computer B

Checkout

File

distributed version control

Computer BVersion Database

Computer AVersion Database

Version 3

Version 2

Version 1 Version 1

Version 2

Version 3

Server ComputerVersion Database

Version 3

Version 2

Version 1

Fully Distributed

(almost) everything is local

git log

git status

Git Configurations

git config --global user.name “My Name”

git config --global user.email “[email protected]

git config --global color.ui true

Create an empty Git repository

git init

touch hello_world.rbgit add hello_world.rb

git commit

Git Clone

git clonehttps://github.com/git/git

Edit files vim / emacs / etc

Stage the changes git add (file)

Review your changes git status / git diff

Commit the changes git commit

A Basic Workflow

Git Version Number

Git Branching

lightweight, movable pointers to a commit

Branch

C1

Snapshot

git checkout -b [branch_name]

git branch

git checkout [branch_name]

git diff

git merge [branch_name]

Master

Commit fb4d2f8

Master

Commitfb4d2f8

HeadHead is

pointer to current branch

Headgit branch i18n

Master

fb4d2f8

Headgit branch i18n

Master

i18n

fb4d2f8

Headgit branch i18n

Master

i18n

fb4d2f8

$ git branch* master* i18n

git branch i18n

fb4d2f8

Head

i18n

$ git branch* master* i18n

Master

git commit

fb4d2f8

Head

i18n

Master

e1c6bf1

git commit

fb4d2f8

Head

i18n

Master

e1c6bf1

git checkout -b iss53 master

fb4d2f8

Master

e1c6bf1

Head

i18n

32ac6d1

git checkout master;git checkout -b iss53

fb4d2f8

Master

e1c6bf1

i18n

32ac6d1

Head

iss53

fb4d2f8

Master

e1c6bf1

i18n

32ac6d1

k134ab1 a18cea1

iss53Head

git commit

Merging

fb4d2f8

Master

e1c6bf1

i18n

32ac6d1

k134ab1 a18cea1

iss53Head

git checkout master

fb4d2f8

Master

e1c6bf1

i18n

32ac6d1

k134ab1 a18cea1

iss53Head

git merge iss53

fb4d2f8

Master

e1c6bf1

i18n

32ac6d1

k134ab1 a18cea1

iss53Head

git checkout master

Snapshot

fast-forward merge

fb4d2f8

Master

e1c6bf1

i18n

32ac6d1

k134ab1 a18cea1

iss53Head

git merge iss53

fb4d2f8

Master

e1c6bf1

i18n

32ac6d1

k134ab1 a18cea1

iss53Head

git merge i18n

non fast-forward merge

fb4d2f8

Master

e1c6bf1

i18n

32ac6d1

k134ab1 a18cea1

iss53Head

git merge i18n

We need a new tree

fb4d2f8

Master

e1c6bf1

i18n

32ac6d1

k134ab1 a18cea1

iss53Head

git merge i18n

Lock History and find best merge base

fb4d2f8

Master

e1c6bf1

i18n

32ac6d1

k134ab1 a18cea1

iss53Head

git merge i18n

c3d Readme.txf13 Hello.c

c3d Readme.tx9ec Hello.c3ab i18n.c

c3d Readme.txf13 Hello.c5ff issue.c

fb4d2f8

Master

e1c6bf1

i18n

32ac6d1

k134ab1 a18cea1

iss53Head

git merge i18n

c3d Readme.txf13 Hello.c

c3d Readme.tx9ec Hello.c3ab i18n.c

c3d Readme.txf13 Hello.c5ff issue.c

Master

e1c6bf1

i18n

32ac6d1

k134ab1 a18cea1

iss53Head

git merge i18n

c3d Readme.tx9ec Hello.c3ab i18n.c

c3d Readme.txf13 Hello.c5ff issue.c

fb4d2f8c3d Readme.txf13 Hello.c

fb4d2f8c3d Readme.tx9ec Hello.c5ff issue.c3ab i18n.c

iss53

e1c6bf1

i18n

32ac6d1

k134ab1 a18cea1master

git merge i18n

c3d Readme.tx9ec Hello.c3ab i18n.c

c3d Readme.txf13 Hello.c5ff issue.c

fb4d2f8c3d Readme.txf13 Hello.c

fb4d2f8c3d Readme.tx9ec Hello.c5ff issue.c3ab i18n.c

Head

iss53

e1c6bf1

i18n

32ac6d1

k134ab1 a18cea1master

git merge i18n

fb4d2f8 954cba1

Head


Recommended