Clone the Repo
$git clone https://github.com/
rantav/devdev.git
Slide 19
Slide 19 text
The Basics
Slide 20
Slide 20 text
git status
Slide 21
Slide 21 text
git add
Slide 22
Slide 22 text
git diff
Slide 23
Slide 23 text
git diff
More here: http://www.gitguys.com/topics/git-diff/
Slide 24
Slide 24 text
git commit
Slide 25
Slide 25 text
git commit --amend
Slide 26
Slide 26 text
git checkout
Slide 27
Slide 27 text
git rm
Slide 28
Slide 28 text
git mv
Slide 29
Slide 29 text
git log
Slide 30
Slide 30 text
git log -p
Slide 31
Slide 31 text
git log --word-diff
Slide 32
Slide 32 text
git log --stat
Slide 33
Slide 33 text
git log hacking
Slide 34
Slide 34 text
git remote
Slide 35
Slide 35 text
git pull
Slide 36
Slide 36 text
To rebase or not to
rebase?
• Prefer rebase
• this keeps the commit log cleaner
•git pl!
• Sometimes an actual merge is needed
• So don’t rebase
• For example, when merging branches
Slide 37
Slide 37 text
git push
Slide 38
Slide 38 text
SVN Parallels
Slide 39
Slide 39 text
Git for SVN
Slide 40
Slide 40 text
Git for SVN
Slide 41
Slide 41 text
Git for SVN
Slide 42
Slide 42 text
Git Lifecycle
Slide 43
Slide 43 text
Git Lifecycle
Slide 44
Slide 44 text
The Staging Area
(AKA The Index)
Slide 45
Slide 45 text
Branching
Slide 46
Slide 46 text
Text
http://pcottle.github.io/learnGitBranching/?demo
A cool demo
1. Create a Branch
git co -b bug-157
Branch Naming:
bug-xxx!
feature-yyy!
wip-zzz
Slide 69
Slide 69 text
2. Add Commits
Commit messages are super important!!!
Slide 70
Slide 70 text
3. Open a Pull
Request
Make sure you assign a reviewer!
Slide 71
Slide 71 text
4. Discuss
AKA Code Review
Continue to commit and push.
This will be reflected
Slide 72
Slide 72 text
5. Merge
Merge means: It’s good for production.
master is always deployable
Slide 73
Slide 73 text
Pull Request Demo
Slide 74
Slide 74 text
Code Review
Slide 75
Slide 75 text
Code Review
Slide 76
Slide 76 text
Protips
Slide 77
Slide 77 text
Protip: How to transition
your team from svn to git
1. Use git-svn, or Svn2git
2. Start using git “as svn” eg no branches
3. Start using branches and pull requests (if
github)
4. Personal opinion: Use only CLI tools
Slide 78
Slide 78 text
Protip: git rebase -i
Slide 79
Slide 79 text
Protip: zsh integration
Slide 80
Slide 80 text
Protip: git stash
Slide 81
Slide 81 text
Extra
Slide 82
Slide 82 text
Conflicts
Slide 83
Slide 83 text
Conflicts
Edit Collision
# Edit file and then
$ git add!
$ git commit
Slide 84
Slide 84 text
Conflicts
Removed File
Slide 85
Slide 85 text
Conflicts
Removed File - Keep
Slide 86
Slide 86 text
Conflicts
Removed File - Remove
Slide 87
Slide 87 text
Conflicts
Git Mergtool
• Not covered here...
• http://git-scm.com/docs/git-mergetool
Slide 88
Slide 88 text
Conflicts
While Rebasing
Slide 89
Slide 89 text
Learning More
Slide 90
Slide 90 text
Refs
http://git-scm.com/about
http://thkoch2001.github.io/whygitisbetter/
http://www.slideshare.net/manishchaks/subversion-
to-git-migration
http://www.git-tower.com/blog/git-for-subversion-
users-cheat-sheet-detail/
http://git.or.cz/course/svn.html
(or: where did I steal from?)