m.mozūras - git

79
git or: how I learned to stop worrying and love source control

Upload: agile-lietuva

Post on 19-Jan-2015

776 views

Category:

Technology


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: M.Mozūras - git

gitor: how I learned to stop

worrying and love source control

Page 2: M.Mozūras - git
Page 3: M.Mozūras - git

why you should

care

Page 4: M.Mozūras - git

Traditional version control systems have deficiencies

Page 5: M.Mozūras - git

Subversion, Perforce, CVS, TFS...

Page 6: M.Mozūras - git

OH, THE PAIN!SLOWTREE CONFLICTSMERGING IS CHALLENGINGBRANCHES ARE JUST COPIES

Page 7: M.Mozūras - git

using svn

Page 8: M.Mozūras - git

using git

Page 9: M.Mozūras - git

is awesomegit

Page 10: M.Mozūras - git

It’s distributed!Distributed Version Control System

Page 11: M.Mozūras - git

Every repository is equal.

Page 12: M.Mozūras - git

You can work offline.

Page 13: M.Mozūras - git

Fast as lightning.

Page 14: M.Mozūras - git

add status diff log commit branch

git mercurial bazaar

Page 15: M.Mozūras - git

Very efficient.

git clone rails - 53 seconds40mb, 2356 files, 29045 commits

Page 16: M.Mozūras - git

Great branching and merging.

Page 17: M.Mozūras - git

Any workflow you want, you got it...

Page 18: M.Mozūras - git

Shared repository

Page 19: M.Mozūras - git

Blessed repositoryLinus Torvalds

Lieutenants

Developers

Page 20: M.Mozūras - git

how to install

Page 21: M.Mozūras - git

Linux: apt-get install git-coreMac OS X: brew install gitWindows: chocolatey install msysgit

Page 22: M.Mozūras - git

Download from git-scm.com

Page 23: M.Mozūras - git

getting

started

Page 24: M.Mozūras - git

git config --global user.name ...git config --global user.email ...

Page 25: M.Mozūras - git

git init

Page 26: M.Mozūras - git

master has no special meaning.It’s just a default branch.

Page 27: M.Mozūras - git

git add

Page 28: M.Mozūras - git

Staging area stores info about what will go into next commit.

Page 29: M.Mozūras - git

working directory

staging area repository

commit

checkout the project

stage files

Page 30: M.Mozūras - git

git commit

Page 31: M.Mozūras - git

189f30b664981e4397625791c8ea3bbb5f2279a3

Commit “name” is a 40-digit SHA

Page 32: M.Mozūras - git

commit 189f30b...

tree e8455...

parent(s) nil

author Mindaugas...

committer Mindaugas...

Initial commit

Page 33: M.Mozūras - git

tree e8455...

blob bc52a... README.md

Page 34: M.Mozūras - git

blob bc52a...

Page 35: M.Mozūras - git

SVN, CVS, Perforce store differences between commits.

Page 36: M.Mozūras - git

Git stores snapshots.

Page 37: M.Mozūras - git

commit0 commit1 commit2

tree0 tree1 tree2

blob A

blob B

blob A blob A2

blob B2 blob B2

Page 38: M.Mozūras - git

Basic training complete.

Page 39: M.Mozūras - git

andpushing

pulling

Page 40: M.Mozūras - git

git remote add origin git@git...

Page 41: M.Mozūras - git

git push origin master

Page 42: M.Mozūras - git

git pull origin master

Page 43: M.Mozūras - git

and mergingbranching

Page 44: M.Mozūras - git

git branch name

Page 45: M.Mozūras - git

Branch is a reference to the head of a line of work.

Page 46: M.Mozūras - git

C0 C1

master

feature

Page 47: M.Mozūras - git

git checkout name

Page 48: M.Mozūras - git

git merge name

Page 49: M.Mozūras - git

C0

master

C1 C2

F1 F2

feature

Page 50: M.Mozūras - git

C0

master

C1 C2

F1 F2

feature

C3

Page 51: M.Mozūras - git

git rebase name

Page 52: M.Mozūras - git

C0

master

C1 C2

F1 F2

feature

Page 53: M.Mozūras - git

C0

master

F2 C2C1 F1

feature

Page 54: M.Mozūras - git

merge is fine, but in a lot of cases, rebase is better.

Page 55: M.Mozūras - git

Branching - too easy not to do

Page 56: M.Mozūras - git

manipulating

history

Page 57: M.Mozūras - git

git commit --amend

Page 58: M.Mozūras - git

git rebase --interactive

Page 59: M.Mozūras - git

Interactive rebase lets you: reword, edit, squash, fixup, exec, remove and reorder.

Page 60: M.Mozūras - git

You can change history of remote repository with git push --force.

Be careful!

Page 61: M.Mozūras - git

Rewriting history is funand useful!

Page 62: M.Mozūras - git

svngit-

Page 63: M.Mozūras - git

git svn clone http://...

Page 64: M.Mozūras - git

git svn rebase ~ svn update

Page 65: M.Mozūras - git

git svn dcommit ~ svn commit

Page 66: M.Mozūras - git

GitHub

Page 67: M.Mozūras - git

The best way to collaborate.

Page 68: M.Mozūras - git

More than 1.6 million people, 2.8 million repositories.

Page 69: M.Mozūras - git

Used by individuals.

Page 70: M.Mozūras - git
Page 71: M.Mozūras - git

And organizations.

Page 72: M.Mozūras - git
Page 73: M.Mozūras - git

thoughts

closing

Page 74: M.Mozūras - git

blame bisect cherry-pick clean cvsimport describe diff fetch filter-branch grep request-pull revert svnimport stash submodule tag and more...

Page 75: M.Mozūras - git

git-scm.comgitready.comgitimmersion.comontwik.com/category/git-github

RESOURCES

Page 76: M.Mozūras - git

Git != Subversion + Magic

Page 77: M.Mozūras - git

The slogan of Subversion for a while was "CVS done right". If you start with that kind of slogan, there's nowhere you can go. There is no way to do CVS right.

Linus Torvalds

Page 79: M.Mozūras - git

codingfearlessly.com

twitter.com/mmozuras

github.com/mmozuras

thanks!