Git can be used like Subversion for version control of code repositories and collaboration. It has advantages like working offline, easier branching workflows, and more open collaboration models. Git encourages practices like fixing bugs in branches before merging into mainline code. Distributed version control allows multiple remote repositories to be used.
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Git As A Subversion Replacement
1. git as a subversion replacement
it’s kinda like subversion, but more awesome!
Josh Nichols technicalpickles.com
2. Outline
• Using how to use git in the same way you've gone
accustomed to using subversion
• Advantages of using git even just like subversion
• Open source collaboration
• Building rails apps on git
Josh Nichols technicalpickles.com
3. Some initial setup
• Need to setup ~/.gitconfig
• Set things like email address and name
• Can setup command aliases for more svn like
commands
Josh Nichols technicalpickles.com
4. ~/.gitconf
[user] [color quot;branchquot;]
email = quot;josh@technicalpickles.comquot; current = yellow reverse
name = quot;Josh Nicholsquot; local = yellow
[alias] remote = green
st = status [color quot;diffquot;]
co = checkout meta = yellow bold
ci = commit frag = magenta bold
[color] old = red bold
branch = auto new = green bold
diff = auto [color quot;statusquot;]
status = auto added = yellow
changed = green
untracked = cyan
Josh Nichols technicalpickles.com
5. Let’s review some subversion
workflows
Josh Nichols technicalpickles.com
6. Initial checkout
svn repository
checkout
developer A developer B
Josh Nichols technicalpickles.com
7. Commit and update
svn repository
update
commit
developer A developer B
Josh Nichols technicalpickles.com
8. Branching
svn repository
cp
sw
developer A developer B
Josh Nichols technicalpickles.com
11. Initial checkout
svn repository git repository
clone
checkout
developer A developer B
developer A developer B
Josh Nichols technicalpickles.com
12. Differences between a checked-out
repository
• subversion:
• keeps a copy of the last revision from repo
• git:
• keeps a copy of the entire repo
Josh Nichols technicalpickles.com
13. Differences between a remote
repository
• subversion:
• can grab any particular path in the repository
• git:
• can only grab the entire repository
• if you copy a checked out repository somewhere,
you can actually use it as a remote repository
Josh Nichols technicalpickles.com
15. Differences for adding
• svn
• used for adding new files
• git
• used for adding new files AND recording
modifications to existing files
Josh Nichols technicalpickles.com
16. Status
• svn:
• svn st
• git:
• git st
Josh Nichols technicalpickles.com
17. Differences for status
• svn:
• tracks: unversioned, new, deleted, modified
• git:
• tracks: unversioned, new, deleted, modified, modified
but not ‘add’-ed
Josh Nichols technicalpickles.com
18. Committing
• svn:
• svn commit
• git:
• git commit
• both:
• can specify files to commit
• can give commit message with -m
Josh Nichols technicalpickles.com
19. Commit
svn repository
git repository
commit
commit
developer A developer B developer A developer B
Josh Nichols technicalpickles.com
20. Differences for committing
• svn:
• sends changes to remote repository
• revision number is incrementing integer
• git:
• only commits to local repository
• revision number is hash of the commit
Josh Nichols technicalpickles.com
21. Pushing to a remote
repository
• svn:
• svn commit
• git:
• git push
Josh Nichols technicalpickles.com
22. Push
svn repository
git repository
commit push
developer A developer B developer A developer B
Josh Nichols technicalpickles.com
26. Differences for reverting
• git
• you don’t ‘revert’ as much as you ‘checkout’ a
version of the last committed change
Josh Nichols technicalpickles.com
31. Branching
svn repository git repository
checkout -b
cp
sw
developer A developer B
developer A developer B
Josh Nichols technicalpickles.com
32. Differences for branching
• svn
• makes changes immediately to remote repo
• git
• local repository only
• ‘git push origin blarg’ to send to remote
Josh Nichols technicalpickles.com
33. Summary so far
• There are a lot of similarities between svn/git
• Main differences so far:
• online v. offline
• commits v. push
• changesets
• Questions?
Josh Nichols technicalpickles.com
37. Offline committing
• Extremely, extremely useful
• Something appealing about committing from the beach
without internet access
Josh Nichols technicalpickles.com
38. Branching
• It actually works really well
• Can merge between branches as much as you want
• Don’t need to worry about specific revisions
• Encourages more branching
• fix branches, feature branches
Josh Nichols technicalpickles.com
39. Using a fix branch
• git checkout -b amazing_fixes
• make changes
• git commit -m “I fixed the hell out of this bug”
• git checkout master
• git merge amazing_fixes
• git push
Josh Nichols technicalpickles.com
40. Distributed
• Can work with multiple remote repositories
• push or pull
Josh Nichols technicalpickles.com
41. One repository to rule them all
Push Push
Core contributor Core contributor
Email patch
Pull
Pull
Random contributor
Random contributor Pull Random contributor
Josh Nichols technicalpickles.com
42. Subversiveness
• Play with subversion and cvs repositories using git!
• git svn clone http://somewhere.com/repo
• git svn dcommit
• replays all your git commits as svn commits
• git svn rebase
• replays remote commits as git commits locally
Josh Nichols technicalpickles.com
43. Open source collaboration
• With subversion, only ‘authorized’ users can ‘commit’
• As a non-committer, can’t make incremental changes
towards a big refactorings
• Typically would send patches around... problematic to
make sure they are up to date
Josh Nichols technicalpickles.com
44. Open source collaboration
• git and github solve all these concerns
• behold, live demo!
Josh Nichols technicalpickles.com
45. Rails development
• Rails 2.1 it supports out of the box (script/install)
• Piston 1.9.x supports it
• LIVE DEMO!!!!1one
Josh Nichols technicalpickles.com