presentation on git, a DVCS

Sitaram Chamarty (sitaramc@gmail.com)

1 preface

1.1 why

1.2 why use a VCS

1.3 VCSs in common use

2 DVCSs and git

2.1 “distributed”?

2.2 disconnected operation

2.3 notes on above

2.4 what’s different about git?

2.5 what’s different about git? (cont’d)

2.6 caveats about git

2.7 history

3 understanding git

3.1 working with git

3.2 some mindset changes needed…

3.3 normal workflow - CVCSs

3.4 normal workflow - most DVCSs

3.5 normal workflow - Git

3.6 something unique to git

4 legacy systems versus git

4.1 problems in SVN

4.2 problems in SVN (cont’d)

4.3 branching in most older VCSs

4.4 problems in SVN (cont’d)

4.5 productivity advantages of git

4.6 Linus on merging

4.7 Linus on merging (cont’d)

4.8 Linus on merging (cont’d)

https://git.or.cz/gitwiki/LinusTalk200705Transcript

If you can do something really fast, really well, people will start using
it differently. One of the things I wanted to make sure is that merges go
really really quickly because I want people to merge often and merge
early, because as it turns out it becomes easier to merge. If you merge
every day, suddenly you never get to the point where you have huge
conflicts that are hard to resolve. So if you actually make branching and
merging easy, you actually avoid a whole class of problems that you
otherwise have a really really hard time avoiding.

4.9 productivity advantages of git (cont’d)

4.10 productivity advantages of git (cont’d)

4.11 productivity advantages of git (cont’d)

4.12 above stuff mostly from

5 examples and canned demos

maintainability – refactor/rename support

developer 1

(notice current branch is master)

developer 2

start a merge in ‘git gui’

merge dev1 into master

merge done

view in gitk

merge dev2 now

done

(Note the details of the merge!)

view in gitk

start a diff in gitk

view diff (old and new master)

maintainability: code movement detection

open ‘git gui blame bundle.c’

hover mouse on line 389

…and see what you get (no other VCS can do this!)

now line 396

hover on the SHA

clicking on the SHA takes you to there

(notice it’s a different file!)

maintainability: code movement detection (cont’d)

maintainability: revision history viewer

open gitk

right click a changed line

(or deleted line) and choose “Show origin…”

and it’ll take you there!

6 concepts again

6.1 git concepts

6.2 concept detail: branches

6.3 git concepts (cont’d)

6.4 git concepts (cont’d)

6.5 some more git concepts

6.6 CVS/SVN equivalence

    CVS                  GIT
    ---                  ---
    checkout             clone
    update               pull
    checkin              commit + push
    add                  add
    remove               rm
    ???                  mv

7 (back to) demos

cool stuff

right click and choose “cherry-pick…”

cherry-pick one more

end result

rebase – what and why

rebase – when and how

starting point for interactive rebase

list of commits

(oldest first, waiting to be edited)

made some changes

then save, exit editor (note sequence and command words)

combined commit message for ‘squash’

edit as needed and save

end result

starting point for a merge

start a merge in ‘git gui’

merge master into my-exp-fixes

merge done

view in gitk

starting point for a rebase

rebase my-exp-fixes onto master (CLI)

view in gitk

8 closing up

8.1 odds and ends

8.2 summary: what is git optimised for

Thank you

Questions?