22
Introduction Basics Using git Other final Git - the stupid content tracker Henrik Austad UNINETT Sigma A/S 15. Oct 2009

git - the stupid content tracker

Embed Size (px)

DESCRIPTION

Basic introduction to git, the object database and the most common commands.

Citation preview

Page 1: git - the stupid content tracker

Introduction Basics Using git Other final

Git - the stupid content tracker

Henrik Austad

UNINETT Sigma A/S

15. Oct 2009

Page 2: git - the stupid content tracker

Introduction Basics Using git Other final

about:henrik

Henrik AustadMSc Engineering Cybernetics

UNINETT Sigma A/S & NDGF

System Developer

Page 3: git - the stupid content tracker

Introduction Basics Using git Other final

Background - In the beginning ... was patch

• Initially written by Linus Torvalds to replace BitKeeper

• First “working” version: April 18th 2005

• git v1.0 December 21th 2005

• Written for• Speed• Track changes• Large projects with active history

Page 4: git - the stupid content tracker

Introduction Basics Using git Other final

Contenders

• Bazaar (bzr)

• Darcs

• Mercurial (hg)

• svk

Page 5: git - the stupid content tracker

Introduction Basics Using git Other final

What does “distributed” mean?

• Everything is local.

• No “need” for a centralized repository.

• Disk is cheap - network is not.

• Lower threshold for new developers, you don’t need specialaccess to the repository to get started.

Page 6: git - the stupid content tracker

Introduction Basics Using git Other final

What does “distributed” mean?

• Everything is local.

• No “need” for a centralized repository.

• Disk is cheap - network is not.

• Lower threshold for new developers, you don’t need specialaccess to the repository to get started.

Page 7: git - the stupid content tracker

Introduction Basics Using git Other final

What does “distributed” mean?

• Everything is local.

• No “need” for a centralized repository.

• Disk is cheap - network is not.

• Lower threshold for new developers, you don’t need specialaccess to the repository to get started.

Page 8: git - the stupid content tracker

Introduction Basics Using git Other final

What does “distributed” mean?

• Everything is local.

• No “need” for a centralized repository.

• Disk is cheap - network is not.

• Lower threshold for new developers, you don’t need specialaccess to the repository to get started.

Page 9: git - the stupid content tracker

Introduction Basics Using git Other final

git objects

• type• blob• tree• commit• tag

• size

• content

Figure: git example.credits: Scott Chacon

Page 10: git - the stupid content tracker

Introduction Basics Using git Other final

git objects

• type• blob• tree• commit• tag

• size

• content

Figure: git example.credits: Scott Chacon

Page 11: git - the stupid content tracker

Introduction Basics Using git Other final

Normal commands

• git clone repo dest

• git init

Page 12: git - the stupid content tracker

Introduction Basics Using git Other final

Normal commands

• git status

• git log start..end

• git branch name of new branch start commit

• git checkout branchname

Page 13: git - the stupid content tracker

Introduction Basics Using git Other final

Normal commands

• git add path/to/file

• git commit -s -m “short commit msg”

• git rebase -i commit

• git cherry-pick commit

Page 14: git - the stupid content tracker

Introduction Basics Using git Other final

Normal commands

• git remote

• git push

• git pull

• git fetch

Page 15: git - the stupid content tracker

Introduction Basics Using git Other final

Normal commands

• git tag

• git diff

• git format-patch

• git am

Page 16: git - the stupid content tracker

Introduction Basics Using git Other final

Normal commands

• git config –global user.name “Henrik Austad”

• git config –global user.email “[email protected]

• git config user.email “[email protected]

• git config push.default current

Page 17: git - the stupid content tracker

Introduction Basics Using git Other final

git merge vs. git rebase

An example, 3 branches, commits done in alphabetical order

Page 18: git - the stupid content tracker

Introduction Basics Using git Other final

git merge vs. git rebase

Merge F and D giving H, then H and G giving I

Page 19: git - the stupid content tracker

Introduction Basics Using git Other final

git merge vs. git rebase

Rebase F onto D, rewriting F to F’, then C-F’ onto G

Page 20: git - the stupid content tracker

Introduction Basics Using git Other final

Hooks - it’s a kind of magic

See .git/hooks/

• pre-commit

• post-update

Page 21: git - the stupid content tracker

Introduction Basics Using git Other final

Visualization

• git log –graph

• git-gui

• gitk

• qgit

Page 22: git - the stupid content tracker

Introduction Basics Using git Other final

Questions?

http://git-scm.com/

mailto:[email protected]

http://www.kernel.org/pub/software/scm/git/docs/everyday.html