277

Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba [email protected] Concepts SCM comp onents SCM op erations Decentralization

  • Upload
    lamliem

  • View
    218

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-Git the basi sBart Trojanowski, bart�jukie.netJukie Networks In .July 9th, 2008

Page 2: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Con eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Page 3: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Next...Con eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Page 4: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Con epts◮ Sour e Control Management

◮ tra k hanges to �les◮ repository / database of hanges◮ working dire tory / urrent state

◮ Centralized SCM◮ server: single database◮ lient: working dire tory & state

◮ De entralized SCM◮ anyone an be a server◮ repository oupled with working dire tory◮ omplete history◮ dis onne ted operation

Page 5: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Con epts◮ Sour e Control Management

◮ tra k hanges to �les◮ repository / database of hanges◮ working dire tory / urrent state

◮ Centralized SCM◮ server: single database◮ lient: working dire tory & state

◮ De entralized SCM◮ anyone an be a server◮ repository oupled with working dire tory◮ omplete history◮ dis onne ted operation

Page 6: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Con epts◮ Sour e Control Management

◮ tra k hanges to �les◮ repository / database of hanges◮ working dire tory / urrent state

◮ Centralized SCM◮ server: single database◮ lient: working dire tory & state

◮ De entralized SCM◮ anyone an be a server◮ repository oupled with working dire tory◮ omplete history◮ dis onne ted operation

Page 7: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Page 8: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

SCM omponentsWorking tree◮ dire tories◮ �les

Page 9: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

SCM omponentsRepository ontents◮ �les

a.cv1

Page 10: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

SCM omponentsRepository ontents◮ �les◮ ommits

a.cv1

b.cv9

metadata

Page 11: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

SCM omponentsRepository ontents◮ �les◮ ommits◮ an estry

A

B C

E

tim

e

D

Page 12: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

SCM omponentsdire ted a y li graph�DAG�

A

B C

D

EG

F

H

Page 13: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

SCM omponentsReferen es◮ tags

A v1.4.4

B C

D

E

v1.5.0

G

F

H

Page 14: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

SCM omponentsReferen es◮ tags◮ bran hes

A v1.4.4

B C

D

E

v1.5.0

G

F

testing

release

topicA

H

Page 15: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

SCM omponentsHEAD◮ urrent he kout◮ points to bran h

A v1.4.4

B C

D

E

v1.5.0

G

F

testing

release

topicA

H

HEAD

Page 16: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

SCM omponentsHEAD◮ urrent he kout◮ points to bran h◮ sometimes deta hed

A v1.4.4

B C

D

E

v1.5.0

G

F

testing

release

topicA

H

HEAD

Page 17: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

SCM omponentsIndex◮ �staging area�◮ what is to be ommitted

A v1.4.4

B C

D

E

v1.5.0

G

F

testing

release

topicA

H

index

HEAD

Page 18: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Page 19: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

SCM operationsBootstrap◮ init◮ he kout◮ swit h bran hModify◮ add, delete, rename◮ ommitInformation◮ status◮ di�◮ logReferen e◮ tag◮ bran h

Page 20: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

SCM operationsBootstrap◮ init◮ he kout◮ swit h bran hModify◮ add, delete, rename◮ ommitInformation◮ status◮ di�◮ logReferen e◮ tag◮ bran h

Page 21: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

SCM operationsBootstrap◮ init◮ he kout◮ swit h bran hModify◮ add, delete, rename◮ ommitInformation◮ status◮ di�◮ logReferen e◮ tag◮ bran h

Page 22: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

SCM operationsBootstrap◮ init◮ he kout◮ swit h bran hModify◮ add, delete, rename◮ ommitInformation◮ status◮ di�◮ logReferen e◮ tag◮ bran h

Page 23: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Centralized SCM

A v1.4.4

B C

D

E

v1.5.0

G

F

testing

release

topicA

H

diff

log

update

checkout

commit

◮ operations require server◮ single point of failure◮ bottlene k

Page 24: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

more SCM operationsDe entralized

◮ lone◮ pull, fet h◮ push

Page 25: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

De entralized SCMpull

pushA v1.4.4

B C

D

E

v1.5.0

G

F

testing

release

topicA

H

clone

A v1.4.4

B C

D

E

v1.5.0

G

F

testing

release

topicA

H

A v1.4.4

B C

D

E

v1.5.0

G

F

testing

release

topicA

H

pull

push

clo

ne

pull

pushclo

ne

◮ anyone an be a server

Page 26: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Page 27: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

De entralizationupstream

◮ publi repository

Page 28: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

De entralizationupstream

local

◮ make a lo al lone

Page 29: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

De entralizationupstream

pristine

topic Atopic B

◮ lo al loning is lighweight

Page 30: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

De entralizationupstream

pristine

topic Atopic B

◮ push hanges between any repositories

Page 31: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

De entralizationupstream web server

pristine

topic Atopic B

◮ publish hanges to publi server

Page 32: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

De entralizationupstream web server

pristine

topic Atopic B

another

◮ share hanges with trusted peers

Page 33: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Is De entralization any good?◮ non-intrusive mi ro- ommits◮ deta hed operation◮ no single point of failure◮ ba kups are trivial

Page 34: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Next...Con eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Page 35: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Birth of GIT◮ 2002

◮ Linus uses BitKeeper for tra king Linux◮ BK gets better◮ Linux development s ales better

◮ April 6, 2005◮ BitMover drops free li ense◮ Linus writes his own SCM, GIT

◮ April 18, 2005◮ GIT an merge

◮ June 16, 2005◮ GIT is o� ially used to tra k Linux

◮ Feb 14, 2007◮ GIT 1.5.0 is released◮ major usability e�ort

Page 36: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Birth of GIT◮ 2002

◮ Linus uses BitKeeper for tra king Linux◮ BK gets better◮ Linux development s ales better

◮ April 6, 2005◮ BitMover drops free li ense◮ Linus writes his own SCM, GIT

◮ April 18, 2005◮ GIT an merge

◮ June 16, 2005◮ GIT is o� ially used to tra k Linux

◮ Feb 14, 2007◮ GIT 1.5.0 is released◮ major usability e�ort

Page 37: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Birth of GIT◮ 2002

◮ Linus uses BitKeeper for tra king Linux◮ BK gets better◮ Linux development s ales better

◮ April 6, 2005◮ BitMover drops free li ense◮ Linus writes his own SCM, GIT

◮ April 18, 2005◮ GIT an merge

◮ June 16, 2005◮ GIT is o� ially used to tra k Linux

◮ Feb 14, 2007◮ GIT 1.5.0 is released◮ major usability e�ort

Page 38: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Birth of GIT◮ 2002

◮ Linus uses BitKeeper for tra king Linux◮ BK gets better◮ Linux development s ales better

◮ April 6, 2005◮ BitMover drops free li ense◮ Linus writes his own SCM, GIT

◮ April 18, 2005◮ GIT an merge

◮ June 16, 2005◮ GIT is o� ially used to tra k Linux

◮ Feb 14, 2007◮ GIT 1.5.0 is released◮ major usability e�ort

Page 39: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Birth of GIT◮ 2002

◮ Linus uses BitKeeper for tra king Linux◮ BK gets better◮ Linux development s ales better

◮ April 6, 2005◮ BitMover drops free li ense◮ Linus writes his own SCM, GIT

◮ April 18, 2005◮ GIT an merge

◮ June 16, 2005◮ GIT is o� ially used to tra k Linux

◮ Feb 14, 2007◮ GIT 1.5.0 is released◮ major usability e�ort

Page 40: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

GIT gets betterAnd then realize that nothing is perfe t. Git is just* loser* to perfe t than any other SCM out there.-Linus

Page 41: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Next...Con eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Page 42: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Page 43: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Stru tureA v1.4.4

B C

D

E

v1.5.0

G

F

testing

release

topicA

H

HEAD

repository

the history

Page 44: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Stru tureA v1.4.4

B C

D

E

v1.5.0

G

F

testing

release

topicA

H

HEAD

repository index100644 20b024 0 bar100644 1d52a6 0 baz100644 20b024 0 sub/fi100644 43dbe0 0 sub/foo

staging area

Page 45: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Stru tureA v1.4.4

B C

D

E

v1.5.0

G

F

testing

release

topicA

H

HEAD

repository index work tree100644 20b024 0 bar100644 1d52a6 0 baz100644 20b024 0 sub/fi100644 43dbe0 0 sub/foo

.|−− bar|−− baz‘−− sub |−− fi ‘−− foo

�les you edit

Page 46: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Stru tureA v1.4.4

B C

D

E

v1.5.0

G

F

testing

release

topicA

H

HEAD

repository index work tree100644 20b024 0 bar100644 1d52a6 0 baz100644 20b024 0 sub/fi100644 43dbe0 0 sub/foo

.|−− bar|−− baz‘−− sub |−− fi ‘−− foo

�staging�addremoverename

Page 47: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Stru tureA v1.4.4

B C

D

E

v1.5.0

G

F

testing

release

topicA

H

HEAD

repository index work tree100644 20b024 0 bar100644 1d52a6 0 baz100644 20b024 0 sub/fi100644 43dbe0 0 sub/foo

.|−− bar|−− baz‘−− sub |−− fi ‘−− foo

� ommitting� ommit

Page 48: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Stru tureA v1.4.4

B C

D

E

v1.5.0

G

F

testing

release

topicA

H

HEAD

repository index work tree100644 20b024 0 bar100644 1d52a6 0 baz100644 20b024 0 sub/fi100644 43dbe0 0 sub/foo

.|−− bar|−− baz‘−− sub |−− fi ‘−− foo

�reading tree� he koutread-treereset

Page 49: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Stru tureA v1.4.4

B C

D

E

v1.5.0

G

F

testing

release

topicA

H

HEAD

repository index work tree100644 20b024 0 bar100644 1d52a6 0 baz100644 20b024 0 sub/fi100644 43dbe0 0 sub/foo

.|−− bar|−− baz‘−− sub |−− fi ‘−− foo

� he king out� he kout he kout-indexreset

Page 50: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

The repository.git|-- HEAD urrent he kout referen e|-- onfig repo private on�g|-- des ription repo des ription|-- hooks| `-- ... hooking s ripts|-- index hanges to ommit|-- info| |-- ex lude repo private| `-- refs refs?|-- logs| `-- ... �re�og� data|-- obje ts| |-- XX| | `-- ... loose obje ts| |-- info| | `-- pa ks info about pa ks| `-- pa k| `-- ... pa ks and indexes`-- refs|-- heads| `-- master master bran h`-- tags`-- ... tags

Page 51: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

The repository.git/ onfig◮ repository on�g.git/des ription◮ des ribes the repositoryuseful for gitweb.git/info/ex lude◮ patterns to ignore

Page 52: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

The repository.git/ onfig◮ repository on�g.git/des ription◮ des ribes the repositoryuseful for gitweb.git/info/ex lude◮ patterns to ignore

Page 53: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

The repository.git/ onfig◮ repository on�g.git/des ription◮ des ribes the repositoryuseful for gitweb.git/info/ex lude◮ patterns to ignore

Page 54: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Page 55: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Obje ts.git/obje ts|-- 23| `-- d4bd826aba9e29aaa e9411 175b784ed 399|-- 76| `-- 49f82d40a98b1ba59057798e47aab2a99a11d3|-- 4| `-- aaefaa8a48ad4ad379d 1002b78f1a3e4 eab |-- e7| `-- 4be61128eef713459 a4e32398d689fe80864e|-- info| `-- pa ks`-- pa k|-- pa k-b7b026b1a0b0f193db9dea0b0d7367d25d3a68 .idx`-- pa k-b7b026b1a0b0f193db9dea0b0d7367d25d3a68 .pa k

Page 56: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Obje ts.git/obje ts|-- 23| `-- d4bd826aba9e29aaa e9411 175b784ed 399|-- 76| `-- 49f82d40a98b1ba59057798e47aab2a99a11d3|-- 4| `-- aaefaa8a48ad4ad379d 1002b78f1a3e4 eab |-- e7| `-- 4be61128eef713459 a4e32398d689fe80864e|-- info| `-- pa ks`-- pa k|-- pa k-b7b026b1a0b0f193db9dea0b0d7367d25d3a68 .idx`-- pa k-b7b026b1a0b0f193db9dea0b0d7367d25d3a68 .pa k�loose obje ts�

Page 57: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Obje ts.git/obje ts|-- 23| `-- d4bd826aba9e29aaa e9411 175b784ed 399|-- 76| `-- 49f82d40a98b1ba59057798e47aab2a99a11d3|-- 4| `-- aaefaa8a48ad4ad379d 1002b78f1a3e4 eab |-- e7| `-- 4be61128eef713459 a4e32398d689fe80864e|-- info| `-- pa ks`-- pa k|-- pa k-b7b026b1a0b0f193db9dea0b0d7367d25d3a68 .idx`-- pa k-b7b026b1a0b0f193db9dea0b0d7367d25d3a68 .pa k�pa k �le�

Page 58: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Obje ts ontent addressabletype size

data

Page 59: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Obje ts ontent addressabletype size

data

SHA1

52a0ff44aba8599f43a5d821c421af316cb7305

Page 60: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Obje ts ontent addressabletype size

data

52a0ff44aba8599f43a5d821c421af316cb7305

Page 61: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Obje ts ontent addressabletype size

data

52a0ff44aba8599f43a5d821c421af316cb7305

Page 62: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Obje ts4 types◮ blobs

"blob" size

file data

Page 63: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Obje ts4 types◮ blobs◮ trees "tree" size

040000 tree 205f6b... somedir

100644 blob 9daeaf... somefil

"tree" size

040000 blob 257cc5... other

Page 64: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Obje ts4 types◮ blobs◮ trees "tree" size

040000 tree 205f6b... somedir

100644 blob 9daeaf... somefil

"tree" size

040000 blob 257cc5... other

"blob" size

file dat

Page 65: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Obje ts4 types◮ blobs◮ trees "tree" size

040000 tree 205f6b... somedir

100644 blob 9daeaf... somefil

"tree" size

040000 blob 257cc5... other

"blob" size

file dat

"blob" size

file dat

Page 66: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Obje ts4 types◮ blobs◮ trees◮ ommits "commit" size

tree cad6ae...

parent 6f0104...

author Someone <address>

comitter Another <address>

commit message

"tree" size

040000 blob 257cc5... other

"blob" size

file dat

"blob" size

file dat

"tree" size

040000 tree 205f6b... somedir

100644 blob 9daeaf... somefil

Page 67: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Obje ts4 types◮ blobs◮ trees◮ ommits "commit" size

tree cad6ae...

parent 6f0104...

author Someone <address>

comitter Another <address>

commit message

"tree" size

040000 blob 257cc5... other

"blob" size

file dat

"blob" size

file dat

"tree" size

040000 tree 205f6b... somedir

100644 blob 9daeaf... somefil

"commit" size

tree cad6ae...

parent 6f0104...

author Someone <address>

comitter Another <address>

commit message

"tree" size

040000 blob 257cc5... other

"blob" size

file dat

"blob" size

file dat

"tree" size

040000 tree 205f6b... somedir

100644 blob 9daeaf... somefil

Page 68: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Obje ts4 types◮ blobs◮ trees◮ ommits "commit" size

tree cad6ae...

parent 6f0104...

author Someone <address>

comitter Another <address>

commit message

"tree" size

040000 blob 257cc5... other

"blob" size

file dat

"blob" size

file dat

"tree" size

040000 tree 205f6b... somedir

100644 blob 9daeaf... somefil

"commit" size

tree cad6ae...

parent 6f0104...

author Someone <address>

comitter Another <address>

commit message

"tree" size

040000 blob 257cc5... other

"blob" size

file dat

"blob" size

file dat

"tree" size

040000 tree 205f6b... somedir

100644 blob 9daeaf... somefil

"commit" size

tree cad6ae...

parent 6f0104...

author Someone <address>

comitter Another <address>

commit message

"tree" size

040000 blob 257cc5... other

"blob" size

file dat

"blob" size

file dat

"tree" size

040000 tree 205f6b... somedir

100644 blob 9daeaf... somefil

Page 69: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Obje ts4 types◮ blobs◮ trees◮ ommits◮ tags "tag" size

object cad6ae...

type commit

tag tag−name

tagger Who <address> + date

tag message

"commit" size

tree cad6ae...

parent 6f0104...

author Someone <address>

comitter Another <address>

commit message

"tree" size

040000 blob 257cc5... other

"blob" size

file dat

"blob" size

file dat

"tree" size

040000 tree 205f6b... somedir

100644 blob 9daeaf... somefil

"commit" size

tree cad6ae...

parent 6f0104...

author Someone <address>

comitter Another <address>

commit message

"tree" size

040000 blob 257cc5... other

"blob" size

file dat

"blob" size

file dat

"tree" size

040000 tree 205f6b... somedir

100644 blob 9daeaf... somefil

Page 70: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Obje tsimmutabletype size

data

Page 71: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Obje tsimmutabletype size

data

type size

data’

Page 72: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Obje tsimmutabletype size

data

type size

data’

SHA1

8a9fd66b8bb939638564ebfdecc23b5d58070fc8

Page 73: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Next...Con eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Page 74: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Page 75: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Git ommands$ git <options> < ommand> <options>

Page 76: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Git ommands (137)add fast-export merge-one-file revertam fast-import merge-resolve rmannotate fet h merge-subtree send-emailapply fet h-pa k merge-tree send-pa kar himport filter-bran h mergetool sh-setupar hive fmt-merge-msg mktag shellbise t for-ea h-ref mktree shortlogblame format-pat h mv showbran h fs k name-rev show-bran hbundle fs k-obje ts pa k-obje ts show-index at-file g pa k-redundant show-ref he k-attr get-tar- ommit-id pa k-refs stash he k-ref-format grep parse-remote status he kout gui pat h-id stripspa e he kout-index hash-obje t peek-remote submodule herry http-fet h prune svn herry-pi k http-push prune-pa ked symboli -ref itool imap-send pull tag lean index-pa k push tar-tree lone init quiltimport unpa k-file ommit init-db read-tree unpa k-obje ts ommit-tree instaweb rebase update-index onfig log re eive-pa k update-ref ount-obje ts lost-found reflog update-server-info vsexport ommit ls-files relink upload-ar hive vsimport ls-remote remote upload-pa k vsserver ls-tree repa k vardaemon mailinfo repo- onfig verify-pa kdes ribe mailsplit request-pull verify-tagdiff merge rerere what hangeddiff-files merge-base reset write-treediff-index merge-file rev-listdiff-tree merge-index rev-parse gitk

Page 77: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Every day use. . .add fast-export merge-one-file revertam fast-import merge-resolve rmannotate fet h merge-subtree send-emailapply fet h-pa k merge-tree send-pa kar himport filter-bran h mergetool sh-setupar hive fmt-merge-msg mktag shellbise t for-ea h-ref mktree shortlogblame format-pat h mv showbran h fs k name-rev show-bran hbundle fs k-obje ts pa k-obje ts show-index at-file g pa k-redundant show-ref he k-attr get-tar- ommit-id pa k-refs stash he k-ref-format grep parse-remote status he kout gui pat h-id stripspa e he kout-index hash-obje t peek-remote submodule herry http-fet h prune svn herry-pi k http-push prune-pa ked symboli -ref itool imap-send pull tag lean index-pa k push tar-tree lone init quiltimport unpa k-file ommit init-db read-tree unpa k-obje ts ommit-tree instaweb rebase update-index onfig log re eive-pa k update-ref ount-obje ts lost-found reflog update-server-info vsexport ommit ls-files relink upload-ar hive vsimport ls-remote remote upload-pa k vsserver ls-tree repa k vardaemon mailinfo repo- onfig verify-pa kdes ribe mailsplit request-pull verify-tagdiff merge rerere what hangeddiff-files merge-base reset write-treediff-index merge-file rev-listdiff-tree merge-index rev-parse gitk

Page 78: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Some GUI tools. . .add fast-export merge-one-file revertam fast-import merge-resolve rmannotate fet h merge-subtree send-emailapply fet h-pa k merge-tree send-pa kar himport filter-bran h mergetool sh-setupar hive fmt-merge-msg mktag shellbise t for-ea h-ref mktree shortlogblame format-pat h mv showbran h fs k name-rev show-bran hbundle fs k-obje ts pa k-obje ts show-index at-file g pa k-redundant show-ref he k-attr get-tar- ommit-id pa k-refs stash he k-ref-format grep parse-remote status he kout gui pat h-id stripspa e he kout-index hash-obje t peek-remote submodule herry http-fet h prune svn herry-pi k http-push prune-pa ked symboli -ref itool imap-send pull tag lean index-pa k push tar-tree lone init quiltimport unpa k-file ommit init-db read-tree unpa k-obje ts ommit-tree instaweb rebase update-index onfig log re eive-pa k update-ref ount-obje ts lost-found reflog update-server-info vsexport ommit ls-files relink upload-ar hive vsimport ls-remote remote upload-pa k vsserver ls-tree repa k vardaemon mailinfo repo- onfig verify-pa kdes ribe mailsplit request-pull verify-tagdiff merge rerere what hangeddiff-files merge-base reset write-treediff-index merge-file rev-listdiff-tree merge-index rev-parse gitk

Page 79: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

O asional use. . .add fast-export merge-one-file revertam fast-import merge-resolve rmannotate fet h merge-subtree send-emailapply fet h-pa k merge-tree send-pa kar himport filter-bran h mergetool sh-setupar hive fmt-merge-msg mktag shellbise t for-ea h-ref mktree shortlogblame format-pat h mv showbran h fs k name-rev show-bran hbundle fs k-obje ts pa k-obje ts show-index at-file g pa k-redundant show-ref he k-attr get-tar- ommit-id pa k-refs stash he k-ref-format grep parse-remote status he kout gui pat h-id stripspa e he kout-index hash-obje t peek-remote submodule herry http-fet h prune svn herry-pi k http-push prune-pa ked symboli -ref itool imap-send pull tag lean index-pa k push tar-tree lone init quiltimport unpa k-file ommit init-db read-tree unpa k-obje ts ommit-tree instaweb rebase update-index onfig log re eive-pa k update-ref ount-obje ts lost-found reflog update-server-info vsexport ommit ls-files relink upload-ar hive vsimport ls-remote remote upload-pa k vsserver ls-tree repa k vardaemon mailinfo repo- onfig verify-pa kdes ribe mailsplit request-pull verify-tagdiff merge rerere what hangeddiff-files merge-base reset write-treediff-index merge-file rev-listdiff-tree merge-index rev-parse gitk

Page 80: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

And the plumbing. . .add fast-export merge-one-file revertam fast-import merge-resolve rmannotate fet h merge-subtree send-emailapply fet h-pa k merge-tree send-pa kar himport filter-bran h mergetool sh-setupar hive fmt-merge-msg mktag shellbise t for-ea h-ref mktree shortlogblame format-pat h mv showbran h fs k name-rev show-bran hbundle fs k-obje ts pa k-obje ts show-index at-file g pa k-redundant show-ref he k-attr get-tar- ommit-id pa k-refs stash he k-ref-format grep parse-remote status he kout gui pat h-id stripspa e he kout-index hash-obje t peek-remote submodule herry http-fet h prune svn herry-pi k http-push prune-pa ked symboli -ref itool imap-send pull tag lean index-pa k push tar-tree lone init quiltimport unpa k-file ommit init-db read-tree unpa k-obje ts ommit-tree instaweb rebase update-index onfig log re eive-pa k update-ref ount-obje ts lost-found reflog update-server-info vsexport ommit ls-files relink upload-ar hive vsimport ls-remote remote upload-pa k vsserver ls-tree repa k vardaemon mailinfo repo- onfig verify-pa kdes ribe mailsplit request-pull verify-tagdiff merge rerere what hangeddiff-files merge-base reset write-treediff-index merge-file rev-listdiff-tree merge-index rev-parse gitk

Page 81: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Helpgit help◮ list of ommon ommandsgit < ommand> -h◮ brief help outputman git-< ommand>git help < ommand>git < ommand> --help◮ manual page

Page 82: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Helpgit help◮ list of ommon ommandsgit < ommand> -h◮ brief help outputman git-< ommand>git help < ommand>git < ommand> --help◮ manual page

Page 83: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Helpgit help◮ list of ommon ommandsgit < ommand> -h◮ brief help outputman git-< ommand>git help < ommand>git < ommand> --help◮ manual page

Page 84: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Con�guration$HOME/.git onfig$ git onfig --global user.name "Your Name"$ git onfig --global user.email you�domain.tld$ git onfig --global olor.pager true$ git onfig --global olor.ui auto

Page 85: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Con�guration$HOME/.git onfig$ git onfig --global user.name "Your Name"$ git onfig --global user.email you�domain.tld$ git onfig --global olor.pager true$ git onfig --global olor.ui auto

Page 86: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Con�guration$HOME/.git onfig$ git onfig --global user.name "Your Name"$ git onfig --global user.email you�domain.tld$ git onfig --global olor.pager true$ git onfig --global olor.ui auto

Page 87: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Con�guration$ at .git onfig[user℄ name = "Bart Trojanowski"email = "bart�jukie.net"signingkey = 2289688F[ ore℄ pager = less -FRSXeditor = vim[ olor℄ ui = auto[merge℄ tool = vimdiff

Page 88: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Page 89: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Bootstrapping$ git init

◮ ran in proje t workspa e◮ reates .git dire tory

Page 90: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

StagingWhat to ommit?◮ additions$ git add file$ git add .◮ removal$ git rm file◮ renames$ git mv old new

Page 91: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

StagingWhat to ommit?◮ additions$ git add file$ git add .◮ removal$ git rm file◮ renames$ git mv old new

Page 92: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

StagingWhat to ommit?◮ additions$ git add file$ git add .◮ removal$ git rm file◮ renames$ git mv old new

Page 93: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

StagingWhat to ommit?◮ additions$ git add file$ git add .◮ removal$ git rm file◮ renames$ git mv old new

Page 94: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Staging$ at .gitignore*.o*~

Page 95: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Committing$ git ommit -a -m�some omment�

◮ will reate a ommit of all or only staged items

Page 96: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Bootstrapping$ mkdir proje t$ d proje t$ git initworking tree

repository

.git

master

HEAD

index

Page 97: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

First ommit$ e ho test > test

working tree

repository

.git

master

HEAD

index

test

Page 98: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Stage$ e ho test > test$ git add testworking tree

repository

.git

master

HEAD

index

test

tree

52a266...

blob

9daefb... "test"

Page 99: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Commit$ e ho test > test$ git add test$ git ommit -m�test�Created initial ommit 6f01040: test1 files hanged, 1 insertions(+),0 deletions(-) reate mode 100644 testworking tree

repository

.git

master

HEAD

commit

6f0104...

index

test

tree

52a266...

blob

9daefb... "test"

Page 100: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Stage another$ e ho test > test$ git add test$ git ommit -m�test�$ mkdir dir$ e ho foo > dir/foo$ git add dir/fooworking tree

repository

.git

master

HEAD

commit

6f0104...

index

test

tree

52a266...

blob

9daefb...

tree

cad6ae...

blob

257cc5...

tree

205f6b...

dir/foo

"test"

"dir"

"foo"

Page 101: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Commit another$ e ho test > test$ git add test$ git ommit -m�test�$ mkdir dir$ e ho foo > dir/foo$ git add dir/foo$ git ommit -m�foo�Created ommit 52a0ff4: foo1 files hanged, 1 insertions(+),0 deletions(-) reate mode 100644 dir/foo working tree

repository

.git

master

HEAD

commit

6f0104...

index

test

tree

52a266...

blob

9daefb...

tree

cad6ae...

blob

257cc5...

tree

205f6b...

commit

52a0ff..

dir/foo

"test"

"dir"

"foo"

Page 102: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Page 103: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Repository status$ git statusshows. . .

◮ staged◮ unstaged◮ untra ked

Page 104: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Di�s$ git diff◮ hanges between index and working �les$ git diff --staged◮ hanges between HEAD and index$ git diff HEAD◮ hanges between HEAD and working �les$ git diff $ ommit $ ommit◮ hanges between two ommits

Page 105: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Di�s$ git diff◮ hanges between index and working �les$ git diff --staged◮ hanges between HEAD and index$ git diff HEAD◮ hanges between HEAD and working �les$ git diff $ ommit $ ommit◮ hanges between two ommits

Page 106: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Di�s$ git diff◮ hanges between index and working �les$ git diff --staged◮ hanges between HEAD and index$ git diff HEAD◮ hanges between HEAD and working �les$ git diff $ ommit $ ommit◮ hanges between two ommits

Page 107: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Di�s$ git diff◮ hanges between index and working �les$ git diff --staged◮ hanges between HEAD and index$ git diff HEAD◮ hanges between HEAD and working �les$ git diff $ ommit $ ommit◮ hanges between two ommits

Page 108: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Obje t referen esspe i� ommit ID. . .full hash 6bb1270ffb60 bfef87266d2d4b4abe4218d9 68short hash 6bb127tag v1.5.6.1lo al bran h masterremote bran h origin/masterby message �:/some text� he kout HEADlast fet h FETCH_HEADprevious head ORIG_HEAD. . .

Page 109: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Obje t referen esa ommit before HEADHEAD^ == HEAD~1

Page 110: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Obje t referen esfew ommits before HEADHEAD^^^ == HEAD~3

Page 111: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Obje t referen esfew ommits before mastermaster^^^ == master~3

Page 112: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Obje t referen eswhat was it yesterday?�{yesterday} == HEAD�{yesterday}

Page 113: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Obje t referen eshow about my-other-bran h on June 1st?my-other-bran h�{June.1}

Page 114: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Obje t referen esmaster a few hanges ago?master�{3}

Page 115: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Show me!review last ommit. . .$ git show ommit 83b2d051814e884a8e264127ed47552a5d f6 1dAuthor: Bart Trojanowski <bart�jukie.net>Date: Thu Jul 3 21:44:39 2008 -0400 hanged one linediff --git a/test b/testindex 808a2 4..99810fa 100644--- a/test+++ b/test�� -1,3 +1,3 ��Some old text before the hange.-Some text for removal.+Repla ement line.Some old text after the hange.

Page 116: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Show me!just the stats. . .$ git show --stat ommit 83b2d051814e884a8e264127ed47552a5d f6 1dAuthor: Bart Trojanowski <bart�jukie.net>Date: Thu Jul 3 21:44:39 2008 -0400 hanged one linetest | 2 +-1 files hanged, 1 insertions(+), 1 deletions(-)

Page 117: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Show me!SVN'esq status information. . .$ git show --name-status ommit 3d3d2989b817af3fd4fa6d63f200113bd6 94bdbAuthor: Bart Trojanowski <bart�jukie.net>Date: Thu Jul 3 22:59:13 2008 -0400something more interestingA sub/barD sub/fooM test

Page 118: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Show me!review any other ommit. . .$ git show HEAD$ git show HEAD^^^$ git show master~10$ git show master�{May.16}. . .

Page 119: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Show me!show a �le (or tree) in history. . .$ git show HEAD:file ontents...

Page 120: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

LogsSee ommit history. . .$ git log ommit 3d3d2989b817af3fd4fa6d63f200113bd6 94bdbAuthor: Bart Trojanowski <bart�jukie.net>Date: Thu Jul 3 22:59:13 2008 -0400most re ent ommit ommit 83b2d051814e884a8e264127ed47552a5d f6 1dAuthor: Bart Trojanowski <bart�jukie.net>Date: Thu Jul 3 21:44:39 2008 -0400se ond most re ent ommit 1 1b35a611 39f49842e2 a28d40886 1ae9b7 Author: Bart Trojanowski <bart�jukie.net>Date: Thu Jul 3 21:44:05 2008 -0400middle ommit ommit 411515f51a78d66a27a7d56ebe9f70dbd2bff008Author: Bart Trojanowski <bart�jukie.net>Date: Thu Jul 3 21:43:36 2008 -0400se ond oldest ommit 52a0ff44aba8599f43a5d821 421af316 b73051Author: Bart Trojanowski <bart�jukie.net>Date: Mon Jun 30 21:44:55 2008 -0400oldest ommit. . .

Page 121: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Logsgit log is awesome!

Page 122: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Logslimit by range. . .$ git log tag..bran h$ git log HEAD~10..$ git log bran h1 bran h2 ^ ommon$ git log -10$ git log -10 master�{yesterday}$ git log --sin e="May 1" --until="June 1"

Page 123: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Logslimit by ommit attributes. . .$ git log --author=fred$ git log -- ommitter=joe$ git log --grep=" ommit.*message.*text"

Page 124: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Logssear h for a hange. . .$ git log -S"some ode hange"$ git log --pi kaxe-regex -S"some.* ode.* hange"

Page 125: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Logslimit by hanges to spe i� path. . .$ git log -- some/file

Page 126: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Faster grepanother way to sear h. . .$ git grep -e "pattern" -- some/file$ git grep -e "pattern" bran h -- some/file

Page 127: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Faster grepanother way to sear h. . .$ git grep -e "pattern" -- some/file$ git grep -e "pattern" bran h -- some/file

Page 128: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Page 129: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Referen esthings that point to ommitslightweightmutabledisposable3 basi types

Page 130: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Referen esthings that point to ommitslightweightmutabledisposable3 basi types

Page 131: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Referen esthings that point to ommitslightweightmutabledisposable3 basi types

Page 132: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Referen esthings that point to ommitslightweightmutabledisposable3 basi types

Page 133: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Referen esthings that point to ommitslightweightmutabledisposable3 basi types

Page 134: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Referen eslo al bran hes

◮ $ git bran h -lbran h1bran h2* master◮ .git/refs/heads/<bran h>

Page 135: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Referen estags

◮ $ git tag -ltag1tag2tag3◮ .git/refs/tags/<tag>

Page 136: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Referen esremote bran hes

◮ $ git bran h -rfred/masterjoe/masterjoe/another-bran h◮ .git/refs/remotes/<remote>/<bran h>

Page 137: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Creating bran hes$ git bran h name ommit

◮ new bran h �name� on HEAD or spe i�ed ommit

Page 138: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Swit hing bran hes$ git he kout -f name

◮ he kout �les from �name� bran h◮ optionally for e overwriting hanged �les

Page 139: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Create and swit h$ git he kout -b name ommit

◮ he kout �les from �name� bran h

Page 140: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Swit hing with hanges$ git he kout nameerror: You have lo al hanges to 'filename'; annot swit h bran hes.$ git he kout -m name

◮ merge outstanding di� onto bran h �name�◮ an result in on�i t

Page 141: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Swit hing with hanges$ git he kout nameerror: You have lo al hanges to 'filename'; annot swit h bran hes.$ git he kout -m name

◮ merge outstanding di� onto bran h �name�◮ an result in on�i t

Page 142: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working on bran hesstart at some treemasterA

Page 143: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working on bran hes$ git he kout -b bug-fixmaster

HEAD

bug−fi A

Page 144: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working on bran hes$ git ommit -a -m�B�master

HEAD

Bbug−fi

A

Page 145: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working on bran hes$ git ommit -a -m�C�master

HEAD

C

B

bug−fi

A

Page 146: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working on bran hesyou have a wi ked ideamaster

HEAD

C

B

bug−fi

A

Page 147: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working on bran hesyou have a wi ked idea$ git he kout -b wi ked mastermaster

HEADC

B

bug−fi

wicked

A

Page 148: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working on bran hes$ git ommit -a -m�D�master

HEAD

C

B

D

bug−fi

wicked

A

Page 149: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working on bran hes$ git ommit -a -m�E�master

HEAD

C

B

E

D

bug−fi

wicked

A

Page 150: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working on bran hesyou're getting somewheremaster

HEAD

C

B

E

D

bug−fi

wicked

A

Page 151: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working on bran hesyou're getting somewhere$ git tag -a -m``got somewhere'' goodmaster

HEAD

C

B

goodE

D

bug−fi

wicked

A

Page 152: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working on bran hesmanager asks about the bugmaster

HEAD

C

B

goodE

D

bug−fi

wicked

A

Page 153: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working on bran hesmanager asks about the bug$ git he kout bug-fixmaster

HEAD

C

B

goodE

D

bug−fi

wicked

A

Page 154: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working on bran hes$ git ommit -a -m�F�master

HEAD

F

C

B

goodE

D

bug−fi wicked

A

Page 155: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working on bran hesyour mind is elsewhere. . .master

HEAD

F

C

B

goodE

D

bug−fi wicked

A

Page 156: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working on bran hesyour mind is elsewhere. . .$ git he kout wi kedHEAD

F

C

B

goodE

D

bug−fi wicked

A master

Page 157: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working on bran hes. . . so you �nish o� the wi kedfeature$ git ommit -a -m�G�HEAD

F

G

C

B

goodE

D

bug−fi

wicked

A master

Page 158: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working on bran hesfeature's donebug is �xed. . . time to merge HEAD

F

G

C

B

goodE

D

bug−fi

wicked

A master

Page 159: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working on bran hesfeature's donebug is �xed. . . time to merge HEAD

F

G

C

B

goodE

D

bug−fi

wicked

A master

Page 160: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working on bran hesfeature's donebug is �xed. . . time to merge HEAD

F

G

C

B

goodE

D

bug−fi

wicked

A master

Page 161: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working on bran hes$ git he kout mastermaster

HEAD

F

G

C

B

goodE

D

bug−fi

wicked

A

Page 162: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working on bran hes$ git reset --hard bug-fixmaster

HEAD

F

G

C

B

goodE

D

bug−fi

wicked

A

Page 163: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working on bran hes$ git merge wi kedmaster

HEAD

H

F

G

C

B

goodE

D

bug−fi

wicked

A

Page 164: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Page 165: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Merging$ git merge <bran h> ...

◮ merge multiple bran hes◮ reates ommit with 2+ parents◮ an ause on�i tsie: require user intervention

Page 166: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Mergingone more exampleA

one

Page 167: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Mergingtwo topi bran hesA

B C

one two

Page 168: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Merging$ git he kout -b three twoA

B C

one twothree

Page 169: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Merging$ git he kout -b three two$ git merge oneA

B C

one two

three

D

Page 170: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Merging

A

B C

D

E F

Gone two

three

Page 171: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Merging$ git he kout threeA

B C

D

E F

Gone two

three

Page 172: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Merging$ git he kout three$ git merge one twoA

B C

D

E F

Gone two

three

H

Page 173: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Merging$ git he kout three$ git merge one two�o topus�

A

B C

D

E F

Gone two

three

H

Page 174: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Page 175: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Rebasing$ git rebase <bran h>

◮ moves new work onto a new baseline◮ an ause on�i tsie: require user intervention

Page 176: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

RebasingC

B

E

D

master

test

A

merge rebase

C

B

E

D

master

test

Atake two identi al trees

Page 177: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

RebasingC

B

E

D

master

test

A

merge rebase

C

B

E

D

master

test

A

F

$ git merge master

Page 178: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

RebasingC

B

E

D

master

test

A

merge rebase

C

B

E

D

master

test

A

F

that's easy

Page 179: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

RebasingC

B

E

D

master

test

A

merge rebase

C

B

E

D

master

test

A

F

$ git rebase master

Page 180: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

RebasingC

B

E

D

master

test

A

merge rebase

C

B

E

D

master

test

A

F

E’

D’

$ git rebase master

Page 181: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

RebasingC

B

E

D

master

test

A

merge rebase

C

B

E

D

master

test

A

F

E’

D’ e

d

$ git rebase master

Page 182: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

RebasingC

B

E

D

master

test

A

merge rebase

C

B

E

D

master

test

A

F

E’

D’ e

d

$ git rebase master

Page 183: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

RebasingC

B

E

D

master

test

A

merge rebase

C

B

E

D

master

test

A

F

E’

D’ e

d

$ git rebase master

Page 184: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

RebasingC

B

E

D

master

test

A

merge rebase

C

B

E

D

master

test

A

F

E’

D’ e

d

$ git rebase master

Page 185: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

RebasingC

B

E

D

master

test

A

merge rebase

C

B

E

D

master

test

A

F

E’

D’ e

d

$ git rebase master

Page 186: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

RebasingC

B

E

D

master

test

A

merge rebase

C

B

E

D

master

test

A

F

E’

D’

$ git rebase master

Page 187: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

RebasingC

B

E

D

master

test

A

merge rebase

C

B

master

test

A

F

E’

D’

Page 188: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Page 189: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Cloning$ git lone <remote>

◮ repli ates remote repository◮ populates new repository◮ he ksout new working tree

Page 190: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Git URLs◮ lo al repo/home/git/proje t.git/file:///home/git/proje t.git/◮ http proto olhttp://repo.or. z/r/git.git◮ native git proto olgit://repo.or. z/git.git◮ ssh proto olssh://bart�jukie.net/~git/proje t.git/bart�jukie.net/~git/proje t.git/

Page 191: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Git URLs◮ lo al repo/home/git/proje t.git/file:///home/git/proje t.git/◮ http proto olhttp://repo.or. z/r/git.git◮ native git proto olgit://repo.or. z/git.git◮ ssh proto olssh://bart�jukie.net/~git/proje t.git/bart�jukie.net/~git/proje t.git/

Page 192: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Git URLs◮ lo al repo/home/git/proje t.git/file:///home/git/proje t.git/◮ http proto olhttp://repo.or. z/r/git.git◮ native git proto olgit://repo.or. z/git.git◮ ssh proto olssh://bart�jukie.net/~git/proje t.git/bart�jukie.net/~git/proje t.git/

Page 193: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Git URLs◮ lo al repo/home/git/proje t.git/file:///home/git/proje t.git/◮ http proto olhttp://repo.or. z/r/git.git◮ native git proto olgit://repo.or. z/git.git◮ ssh proto olssh://bart�jukie.net/~git/proje t.git/bart�jukie.net/~git/proje t.git/

Page 194: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

repo.or.cz

git://repo.or. z/proje t.git

Page 195: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

repo.or.cz

$ git lone ssh+git://repo.or. z/proje t.git

Page 196: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

repo.or.cz local

$ git lone ssh+git://repo.or. z/proje t.gitInitialize proje t/.gitInitialized empty Git repository in /tmp/proje t/.git/remote: Counting obje ts: 77575, done.remote: Compressing obje ts: 100% (26407/26407), done.remote: Total 77575 (delta 55750), reused 71007 (delta 49775)Re eiving obje ts: 100% (77575/77575), 22.87 MiB | 798 KiB/s, done.Resolving deltas: 100% (55750/55750), done.Che king out files: 100% (1396/1396), done.

Page 197: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

repo.or.cz local

$ git lone ssh+git://repo.or. z/proje t.gitInitialize proje t/.gitInitialized empty Git repository in /tmp/proje t/.git/remote: Counting obje ts: 77575, done.remote: Compressing obje ts: 100% (26407/26407), done.remote: Total 77575 (delta 55750), reused 71007 (delta 49775)Re eiving obje ts: 100% (77575/77575), 22.87 MiB | 798 KiB/s, done.Resolving deltas: 100% (55750/55750), done.Che king out files: 100% (1396/1396), done.

Page 198: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

repo.or.cz local

$ git lone ssh+git://repo.or. z/proje t.git build-treeInitialize build-tree/.gitInitialized empty Git repository in /tmp/build-tree/.git/remote: Counting obje ts: 77575, done.remote: Compressing obje ts: 100% (26407/26407), done.remote: Total 77575 (delta 55750), reused 71007 (delta 49775)Re eiving obje ts: 100% (77575/77575), 22.87 MiB | 798 KiB/s, done.Resolving deltas: 100% (55750/55750), done.Che king out files: 100% (1396/1396), done.

Page 199: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

repo.or.cz local

$ git lone ssh+git://repo.or. z/proje t.gitInitialize proje t/.gitInitialized empty Git repository in /tmp/proje t/.git/remote: Counting obje ts: 77575, done.remote: Compressing obje ts: 100% (26407/26407), done.remote: Total 77575 (delta 55750), reused 71007 (delta 49775)Re eiving obje ts: 100% (77575/77575), 22.87 MiB | 798 KiB/s, done.Resolving deltas: 100% (55750/55750), done.Che king out files: 100% (1396/1396), done.

Page 200: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

repo.or.cz local

A v0.1.0

B

C v0.2.0

F

origin/master

$ git lone ssh+git://repo.or. z/proje t.gitInitialize proje t/.gitInitialized empty Git repository in /tmp/proje t/.git/remote: Counting obje ts: 77575, done.remote: Compressing obje ts: 100% (26407/26407), done.remote: Total 77575 (delta 55750), reused 71007 (delta 49775)Re eiving obje ts: 100% (77575/77575), 22.87 MiB | 798 KiB/s, done.Resolving deltas: 100% (55750/55750), done.Che king out files: 100% (1396/1396), done.

Page 201: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

repo.or.cz local

A v0.1.0

B

C v0.2.0

F

origin/master

$ git lone ssh+git://repo.or. z/proje t.gitInitialize proje t/.gitInitialized empty Git repository in /tmp/proje t/.git/remote: Counting obje ts: 77575, done.remote: Compressing obje ts: 100% (26407/26407), done.remote: Total 77575 (delta 55750), reused 71007 (delta 49775)Re eiving obje ts: 100% (77575/77575), 22.87 MiB | 798 KiB/s, done.Resolving deltas: 100% (55750/55750), done.Che king out files: 100% (1396/1396), done.

Page 202: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin" local

A v0.1.0

B

C v0.2.0

F

origin/master

$ git lone ssh+git://repo.or. z/proje t.gitInitialize proje t/.gitInitialized empty Git repository in /tmp/proje t/.git/remote: Counting obje ts: 77575, done.remote: Compressing obje ts: 100% (26407/26407), done.remote: Total 77575 (delta 55750), reused 71007 (delta 49775)Re eiving obje ts: 100% (77575/77575), 22.87 MiB | 798 KiB/s, done.Resolving deltas: 100% (55750/55750), done.Che king out files: 100% (1396/1396), done.

Page 203: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin" local

A v0.1.0

B

C v0.2.0

F

origin/master

master

/tmp/project/|−− .git/|−− bar‘−− sub/ ‘−− foo$ git lone ssh+git://repo.or. z/proje t.gitInitialize proje t/.gitInitialized empty Git repository in /tmp/proje t/.git/remote: Counting obje ts: 77575, done.remote: Compressing obje ts: 100% (26407/26407), done.remote: Total 77575 (delta 55750), reused 71007 (delta 49775)Re eiving obje ts: 100% (77575/77575), 22.87 MiB | 798 KiB/s, done.Resolving deltas: 100% (55750/55750), done.Che king out files: 100% (1396/1396), done.

Page 204: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin" local

A v0.1.0

B

C v0.2.0

F

origin/master

master

/tmp/project/|−− .git/|−− bar‘−− sub/ ‘−− foo$ git bran h -a* masterorigin/master $ git tag -lv0.1.0v0.2.0

Page 205: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin" local

A v0.1.0

B

C v0.2.0

F

origin/master

master

/tmp/project/|−− .git/|−− bar‘−− sub/ ‘−− foo$ git bran h -a* masterorigin/master $ git tag -lv0.1.0v0.2.0

Page 206: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin" local

A v0.1.0

B

C v0.2.0

F

origin/master

master

/tmp/project/|−− .git/|−− bar‘−− sub/ ‘−− foo

G

H

Page 207: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin" local

A v0.1.0

B

C v0.2.0

F

origin/master

master

/tmp/project/|−− .git/|−− bar‘−− sub/ ‘−− foo

G

H

$ git fet h

Page 208: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin" local

A v0.1.0

B

C v0.2.0

F

origin/master

master

/tmp/project/|−− .git/|−− bar‘−− sub/ ‘−− foo

G

H

$ git fet hremote: Counting obje ts: 236, done.remote: Compressing obje ts: 100% (190/190), done.remote: Total 190 (delta 170), reused 0 (delta 0)Re eiving obje ts: 100% (190/190), 69.53 KiB, done.Resolving deltas: 100% (170/170), ompleted with 40 lo al obje ts.From mail.jukie.net:work/o lug/intro-to-git573ff80..06e3703 master -> origin/master

Page 209: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin" local

A v0.1.0

B

C v0.2.0

F

origin/master

master

/tmp/project/|−− .git/|−− bar‘−− sub/ ‘−− foo

G

H

$ git fet hremote: Counting obje ts: 236, done.remote: Compressing obje ts: 100% (190/190), done.remote: Total 190 (delta 170), reused 0 (delta 0)Re eiving obje ts: 100% (190/190), 69.53 KiB, done.Resolving deltas: 100% (170/170), ompleted with 40 lo al obje ts.From mail.jukie.net:work/o lug/intro-to-git573ff80..06e3703 master -> origin/master

Page 210: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin" local

A v0.1.0

B

C v0.2.0

F

origin/master

master

/tmp/project/|−− .git/|−− bar‘−− sub/ ‘−− foo

G

H

G

H

$ git fet hremote: Counting obje ts: 236, done.remote: Compressing obje ts: 100% (190/190), done.remote: Total 190 (delta 170), reused 0 (delta 0)Re eiving obje ts: 100% (190/190), 69.53 KiB, done.Resolving deltas: 100% (170/170), ompleted with 40 lo al obje ts.From mail.jukie.net:work/o lug/intro-to-git573ff80..06e3703 master -> origin/master

Page 211: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin" local

A v0.1.0

B

C v0.2.0

F

origin/master

master

/tmp/project/|−− .git/|−− bar‘−− sub/ ‘−− foo

G

H

G

H

. . . no disk hanges?

Page 212: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin" local

A v0.1.0

B

C v0.2.0

F

origin/master

master

/tmp/project/|−− .git/|−− bar‘−− sub/ ‘−− foo

G

H

G

H

git fet h only updates DAG

Page 213: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin" local

A v0.1.0

B

C v0.2.0

F

origin/master

master

/tmp/project/|−− .git/|−− bar‘−− sub/ |−− fi ‘−− foo

G

H

G

H

git merge origin/masterfast-forwards master to mat h origin/masterand updates the working tree

Page 214: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin" local

A v0.1.0

B

C v0.2.0

F

origin/master

master

/tmp/project/|−− .git/|−− bar‘−− sub/ |−− fi ‘−− foo

G

H

G

H

git merge origin/masterfast-forwards master to mat h origin/masterand updates the working tree

Page 215: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin" local

A v0.1.0

B

C v0.2.0

F

origin/master

master

/tmp/project/|−− .git/|−− bar‘−− sub/ |−− fi ‘−− foo

G

H

G

H

git merge origin/masterfast-forwards master to mat h origin/masterand updates the working tree

Page 216: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin" local

A v0.1.0

B

C v0.2.0

F

origin/master

master

/tmp/project/|−− .git/|−− bar‘−− sub/ |−− fi ‘−− foo

G

H

G

H

git fet h + git merge=git pull

Page 217: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin" local

A v0.1.0

B

C v0.2.0

F

origin/master

master

/tmp/project/|−− .git/|−− bar‘−− sub/ |−− fi ‘−− foo

G

H

G

H

git fet h + git merge=git pull

Page 218: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin" local

A v0.1.0

B

C v0.2.0

F

origin/master

master

/tmp/project/|−− .git/|−− bar‘−− sub/ |−− fi ‘−− foo

G

H

G

H

let's make some lo al ommits

Page 219: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin" local

A v0.1.0

B

C v0.2.0

F

origin/master

master

/tmp/project/|−− .git/|−− bar‘−− sub/ |−− fi ‘−− foo

G

H

G

H

$ git ommit -a -m``I''

Page 220: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin" local

A v0.1.0

B

C v0.2.0

F

origin/master

master

/tmp/project/|−− .git/|−− bar‘−− sub/ |−− fi ‘−− foo

G

H

G

H

I

$ git ommit -a -m``I''Created ommit b618aed: I2 files hanged, 11 insertions(+), 20 deletions(-)

Page 221: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin" local

A v0.1.0

B

C v0.2.0

F

origin/master

master

/tmp/project/|−− .git/|−− bar‘−− sub/ |−− fi ‘−− foo

G

H

G

H

I

Page 222: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin" local

A v0.1.0

B

C v0.2.0

F

origin/master

master

/tmp/project/|−− .git/|−− bar‘−− sub/ |−− fi ‘−− foo

G

H

G

H

I

$ git push

Page 223: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin" local

A v0.1.0

B

C v0.2.0

F

origin/master

master

/tmp/project/|−− .git/|−− bar‘−− sub/ |−− fi ‘−− foo

G

H

G

H

II

$ git pushCounting obje ts: 9, done.Compressing obje ts: 100% (5/5), done.Writing obje ts: 100% (5/5), 810 bytes, done.Total 5 (delta 4), reused 0 (delta 0)refs/heads/master: 9dd 135 -> 15b67 0To ssh+git://repo.or. z/proje t.git9dd 135..15b67 0 master -> master

Page 224: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin" local

A v0.1.0

B

C v0.2.0

F

origin/master

master

/tmp/project/|−− .git/|−− bar‘−− sub/ |−− fi ‘−− foo

G

H

G

H

II

$ git pushCounting obje ts: 9, done.Compressing obje ts: 100% (5/5), done.Writing obje ts: 100% (5/5), 810 bytes, done.Total 5 (delta 4), reused 0 (delta 0)refs/heads/master: 9dd 135 -> 15b67 0To ssh+git://repo.or. z/proje t.git9dd 135..15b67 0 master -> master

Page 225: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin" local

A v0.1.0

B

C v0.2.0

F

origin/master

master

/tmp/project/|−− .git/|−− bar‘−− sub/ |−− fi ‘−− foo

G

H

G

H

II

Page 226: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin"

G

H

I

foo.com

. . . meanwhile, elsewhere on the internet . . .

Page 227: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin"

G

H

I

foo.com

Fred lones the proje t.

Page 228: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin"

G

H

I

A v0.1.0

B

C v0.2.0

F

master

foo.com

G

H

I

Fred lones the proje t.

Page 229: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin"

G

H

I

A v0.1.0

B

C v0.2.0

F

master

foo.com

G

H

I

J

. . . and makes some hanges.

Page 230: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin"

G

H

I

A v0.1.0

B

C v0.2.0

F

master

foo.com

G

H

I

J

Fred annot push.

Page 231: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin"

G

H

I

A v0.1.0

B

C v0.2.0

F

master

foo.com

G

H

I

J

From: fred�foo. omSubje t: I fixed a bugPlease pull fromhttp://foo. om/proje t.git/-Fred

Page 232: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin"

G

H

I

A v0.1.0

B

C v0.2.0

F

master

foo.com

G

H

I

J

local

A v0.1.0

B

C v0.2.0

F

ori

gin

/maste

r

master

/tmp/project/|−− .git/|−− bar‘−− sub/ |−− fi ‘−− foo

G

H

I

K

From: fred�foo. omSubje t: I fixed a bugPlease pull fromhttp://foo. om/proje t.git/-Fred

Page 233: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin"

G

H

I

A v0.1.0

B

C v0.2.0

F

master

foo.com

G

H

I

J

local

A v0.1.0

B

C v0.2.0

F

ori

gin

/maste

r

master

/tmp/project/|−− .git/|−− bar‘−− sub/ |−− fi ‘−− foo

G

H

I

K

$ git remote add fred http://foo. om/proje t.git/

Page 234: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin"

G

H

I

A v0.1.0

B

C v0.2.0

F

master

foo.com

G

H

I

J

local

A v0.1.0

B

C v0.2.0

F

ori

gin

/maste

r

master

/tmp/project/|−− .git/|−− bar‘−− sub/ |−− fi ‘−− foo

G

H

I

K

$ git remote add fred http://foo. om/proje t.git/

Page 235: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin"

G

H

I

A v0.1.0

B

C v0.2.0

F

master

"fred"

G

H

I

J

local

A v0.1.0

B

C v0.2.0

F

/tmp/project/|−− .git/|−− bar‘−− sub/ |−− fi ‘−− foo

G

Hori

gin

/maste

r

master

I

K

$ git remote add fred http://foo. om/proje t.git/

Page 236: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin"

G

H

I

A v0.1.0

B

C v0.2.0

F

master

"fred"

G

H

I

J

local

A v0.1.0

B

C v0.2.0

F

/tmp/project/|−− .git/|−− bar‘−− sub/ |−− fi ‘−− foo

G

Hori

gin

/maste

r

master

I

K

$ git fet h fred

Page 237: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin"

G

H

I

A v0.1.0

B

C v0.2.0

F

master

"fred"

G

H

I

J

local

/tmp/project/|−− .git/|−− bar‘−− sub/ |−− fi ‘−− foo

A v0.1.0

B

C v0.2.0

FG

Hori

gin

/maste

r

master

I

K

$ git fet h fred

Page 238: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin"

G

H

I

A v0.1.0

B

C v0.2.0

F

master

"fred"

G

H

I

J

local

/tmp/project/|−− .git/|−− bar‘−− sub/ |−− fi ‘−− foo

A v0.1.0

B

C v0.2.0

FG

Hori

gin

/maste

r

master

I

K J

fred

/maste

r

$ git fet h fred

Page 239: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin"

G

H

I

A v0.1.0

B

C v0.2.0

F

master

"fred"

G

H

I

J

local

/tmp/project/|−− .git/|−− bar‘−− sub/ |−− fi ‘−− foo

A v0.1.0

B

C v0.2.0

FG

Hori

gin

/maste

r

master

I

K J

fred

/maste

r

Page 240: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin"

G

H

I

A v0.1.0

B

C v0.2.0

F

master

"fred"

G

H

I

J

local

/tmp/project/|−− .git/|−− bar‘−− sub/ |−− fi ‘−− foo

A v0.1.0

B

C v0.2.0

FG

Hori

gin

/maste

r

master

I

K J

fred/m

aste

r

$ git log fred/master

Page 241: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin"

G

H

I

A v0.1.0

B

C v0.2.0

F

master

"fred"

G

H

I

J

local

/tmp/project/|−− .git/|−− bar‘−− sub/ |−− fi ‘−− foo

A v0.1.0

B

C v0.2.0

FG

Hori

gin

/maste

r

master

I

K J

fred/m

aste

r

$ git log fred/master$ git log fred/master ^master

Page 242: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin"

G

H

I

A v0.1.0

B

C v0.2.0

F

master

"fred"

G

H

I

J

local

/tmp/project/|−− .git/|−− bar‘−− sub/ |−− fi ‘−− foo

A v0.1.0

B

C v0.2.0

FG

Hori

gin

/maste

r

master

I

K J

fred/m

aste

r

$ git log fred/master$ git log fred/master ^master$ git log -p fred/master ^master

Page 243: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin"

G

H

I

A v0.1.0

B

C v0.2.0

F

master

"fred"

G

H

I

J

local

/tmp/project/|−− .git/|−− bar‘−− sub/ |−− fi ‘−− foo

A v0.1.0

B

C v0.2.0

FG

Hori

gin

/maste

r

master

I

K J

fred/m

aste

r

$ git he kout -b fred-fix fred/master

Page 244: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin"

G

H

I

A v0.1.0

B

C v0.2.0

F

master

"fred"

G

H

I

J

local

/tmp/project/|−− .git/|−− bar‘−− sub/ |−− fi ‘−− foo

A v0.1.0

B

C v0.2.0

FG

Hori

gin

/maste

r

master

I

K J

fred/m

aste

r

fred−fi

$ git he kout -b fred-fix fred/master

Page 245: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin"

G

H

I

A v0.1.0

B

C v0.2.0

F

master

"fred"

G

H

I

J

local

/tmp/project/|−− .git/|−− bar‘−− sub/ |−− fi ‘−− foo

A v0.1.0

B

C v0.2.0

FG

Hori

gin

/maste

r

master

I

K J

fred/m

aste

r

fred−fi

$ git he kout master

Page 246: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin"

G

H

I

A v0.1.0

B

C v0.2.0

F

master

"fred"

G

H

I

J

local

/tmp/project/|−− .git/|−− bar‘−− sub/ |−− fi ‘−− foo

A v0.1.0

B

C v0.2.0

FG

Hori

gin

/maste

r

master

I

K J

fred/m

aste

r

fred−fiL

$ git he kout master$ git merge fred-fix

Page 247: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin"

G

H

I

A v0.1.0

B

C v0.2.0

F

master

"fred"

G

H

I

J

local

/tmp/project/|−− .git/|−− bar‘−− sub/ |−− fi ‘−− foo

A v0.1.0

B

C v0.2.0

FG

Hori

gin

/maste

r

master

I

K J

fred/m

aste

r

L

$ git he kout master$ git merge fred-fix$ git bran h -d fred-fix

Page 248: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin"

G

H

I

A v0.1.0

B

C v0.2.0

F

master

"fred"

G

H

I

J

local

/tmp/project/|−− .git/|−− bar‘−− sub/ |−− fi ‘−− foo

A v0.1.0

B

C v0.2.0

FG

Hori

gin

/maste

r

master

I

K J

fred/m

aste

r

L

$ git push

Page 249: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin"

G

H

I

A v0.1.0

B

C v0.2.0

F

master

"fred"

G

H

I

J

local

/tmp/project/|−− .git/|−− bar‘−− sub/ |−− fi ‘−− foo

A v0.1.0

B

C v0.2.0

FG

Hori

gin

/maste

r

master

I

K J

fred/m

aste

r

L

K J

L

$ git push

Page 250: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin"

G

H

I

A v0.1.0

B

C v0.2.0

F

master

"fred"

G

H

I

J

local

/tmp/project/|−− .git/|−− bar‘−− sub/ |−− fi ‘−− foo

A v0.1.0

B

C v0.2.0

FG

H

ori

gin

/maste

r master

I

K J

fred/m

aste

r

L

K J

L

$ git push

Page 251: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Working with remotesA v0.1.0

B

C v0.2.0

F

master

"origin"

G

H

I

A v0.1.0

B

C v0.2.0

F

master

"fred"

G

H

I

J

local

/tmp/project/|−− .git/|−− bar‘−− sub/ |−− fi ‘−− foo

A v0.1.0

B

C v0.2.0

FG

H

ori

gin

/maste

r master

I

K J

fred/m

aste

r

L

K J

L

Page 252: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Page 253: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

GUI tools◮ gitksexy view of your revision tree◮ git guiperform trivial tasks from a GUIex: add/rm �les, make ommits, bran h, et

Page 254: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

GUI tools◮ gitksexy view of your revision tree◮ git guiperform trivial tasks from a GUIex: add/rm �les, make ommits, bran h, et

Page 255: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

gitkhow sexy?

Page 256: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

gitk

Page 257: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

git-gui

Page 258: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Page 259: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-Remember loose obje ts ?

Page 260: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Loose obje ts.git/obje ts|-- 23| `-- d4bd826aba9e29aaa e9411 175b784ed 399|-- 76| `-- 49f82d40a98b1ba59057798e47aab2a99a11d3|-- 4| `-- aaefaa8a48ad4ad379d 1002b78f1a3e4 eab |-- e7| `-- 4be61128eef713459 a4e32398d689fe80864e|-- info| `-- pa ks`-- pa k|-- pa k-b7b026b1a0b0f193db9dea0b0d7367d25d3a68 .idx`-- pa k-b7b026b1a0b0f193db9dea0b0d7367d25d3a68 .pa k

Page 261: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Loose obje ts$ git g Counting obje ts: 636, done.Compressing obje ts: 100% (635/635), done.Writing obje ts: 100% (636/636), done.Total 636 (delta 486), reused 0 (delta 0)Removing dupli ate obje ts: 100% (256/256), done.◮ GC happens automati allywhen you get to 6700 obje ts( on�gurable)

Page 262: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Loose obje ts$ git g Counting obje ts: 636, done.Compressing obje ts: 100% (635/635), done.Writing obje ts: 100% (636/636), done.Total 636 (delta 486), reused 0 (delta 0)Removing dupli ate obje ts: 100% (256/256), done.◮ GC happens automati allywhen you get to 6700 obje ts( on�gurable)

Page 263: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-Stash

Page 264: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Stashing◮ you're ha king◮ got debug ode you don't want to ommit◮ need to work on something else

Page 265: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Stashing◮ you're ha king◮ got debug ode you don't want to ommit◮ need to work on something else

Page 266: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Stashing◮ you're ha king◮ got debug ode you don't want to ommit◮ need to work on something else

Page 267: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Stashing◮ git stash �des ription�◮ do that other thing◮ git stash apply

Page 268: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Stashing◮ git stash �des ription�◮ do that other thing◮ git stash apply

Page 269: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Stashing◮ git stash �des ription�◮ do that other thing◮ git stash apply

Page 270: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Page 271: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Further readinggit.or. zgit.or. z/gitwikiGitCasts. om(S ott Cha on)

Page 272: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Further readinggit.or. zgit.or. z/gitwikiGitCasts. om(S ott Cha on)

Page 273: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Further readinggit.or. zgit.or. z/gitwikiGitCasts. om(S ott Cha on)

Page 274: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Further readinghttp://www.jukie.net/~bart/blog/git://ta hyon.jukie.net/intro-to-git.git/

Page 275: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-

Further readinghttp://www.jukie.net/~bart/blog/git://ta hyon.jukie.net/intro-to-git.git/

Page 276: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-Thank you.

Page 277: Git the basics - Excessedgyu.excess.org/git-tutorial/2008-07-09/intro-to-git.pdf · Git the basics Ba rt T rojano wski, ba rt@jukie.net Concepts SCM comp onents SCM op erations Decentralization

Git the basi sBartTrojanowski,bart�jukie.netCon eptsSCM omponentsSCM operationsDe entralizationGIT HistoryRepositoryStru tureObje tsUsing GITCommandsCommitInspe tionBran hingMergingRebasingRemotesGUI toolsLoose ends-Q & A