SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.
SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.
Successfully reported this slideshow.
Activate your 14 day free trial to unlock unlimited reading.
Getting Started with (Distributed) Version Control
Getting Started with (Distributed) Version Control
1.
Getting Started with
(Distributed) Version Control
Because what other tools have a blame
command?
John Paulett
jhcore.com
April 3, 2009 1
2.
Collaboration
Bob adds foo() to main.c while Alice edits
bar() in main.c. How do they merge?
Please do not share code via Windows file
sharing!
April 3, 2009 2
3.
History
quot;Oops, we screwed up the release, can we
roll back to the last production version?quot;
“Who added this bug?”
April 3, 2009 3
4.
Backup
quot;The Photoshop keygen gave me a virus.quot;
Sharing files between computers
April 3, 2009 4
5.
Personally
Open source projects
Personal projects (master's thesis code)
School files (papers, assignments)
Config files (~/.ssh/config, ~/.hgrc)
April 3, 2009 5
6.
Centeralized vs Decentralized
Cathedral vs Bazaar
Offline commits
More atomic commits
●
Forking is encouraged
Can keep private until ready
●
http://en.wikipedia.org/wiki/index.html?curid=755487
April 3, 2009 6
9.
Which one?
The new “vim vs emacs”
http://xkcd.com/378/
(emacs is better)
April 3, 2009 9
10.
Mercurial
OpenJDK
●
Solaris
●
Python
●
Mozilla
●
Netbeans
●
April 3, 2009 10
11.
Workflow
1. Checkout / Start repo
2. Add / Remove / Edit files
3. Commit your changes
4. Push changes
5. Update / Merge
6. Go to #2
April 3, 2009 11
12.
Simple Example
# checkout the repository
hg clone http://bitbucket.org/johnpaulett/python-hl7/
# add the file server.py to be under version control
hg add server.py
# commit the file
hg commit -m quot;Added a single threaded HL7 socket
server.quot;
April 3, 2009 12
13.
Simple Example
# Send my changes to bitbucket
hg push
# Pull others' changes from bitbucket
hg pull
hg update
# Merge in anyone else's changes
hg merge
April 3, 2009 13
14.
Useful Commands
Start a repository:
hg init my-emr
Find out who changed what in which
version:
hg blame
hg log
April 3, 2009 14
15.
But I Hate the Command Line
TortoiseHg
April 3, 2009 15
16.
But I Hate the Command Line
MercurialEclipse
April 3, 2009 16
17.
Being a DVCS Dog
quot;On the Internet, nobody knows that you're
a dog.quot;
hgsubversion
git-svn
April 3, 2009 17
New Yorker, 1993
20.
Bad Commit Messages
Not Atomic
“Fixed a few bugs in the interface.
Added an ID field. Removed a couple
unnecessary functions. Refactored the
context check.”
Not Specific
“Fixed some bugs.”
http://lbrandy.com/blog/2009/03/writing-better-commit-messages/
April 3, 2009 20
21.
Customizing
hgrc
Set locations, username, plugins
.hgignore
Ignore unwanted files (*.class, *.pyc,
*.log)
April 3, 2009 21
22.
More Info
http://www.slideshare.net/johnpaulett/getting-started-with-
●
distributed-version-control
http://www.selenic.com/mercurial/wiki/
●
http://betterexplained.com/articles/intro-to-distributed-version-
●
control-illustrated/
http://bitbucket.org/
●
http://joshcarter.com/productivity/svn_hg_git_for_home_directory
●
http://lbrandy.com/blog/2009/03/writing-better-commit-messages/
●
http://bitbucket.org/mercurialeclipse/main/wiki/Home
●
http://bitbucket.org/durin42/hgsubversion/wiki/Home
●
http://bitbucket.org/tortoisehg/stable/wiki/Home
●
April 3, 2009 22