getting started with (distributed) version control
Post on 29-Nov-2014
4.291 Views
Preview:
DESCRIPTION
TRANSCRIPT
April 3, 2009 1
Getting Started with (Distributed) Version Control
Because what other tools have a blame command?
John Paulettjhcore.com
April 3, 2009 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 3
History
"Oops, we screwed up the release, can we roll back to the last production version?"
“Who added this bug?”
April 3, 2009 4
Backup
"The Photoshop keygen gave me a virus."
Sharing files between computers
April 3, 2009 5
Personally
Open source projects
Personal projects (master's thesis code)
School files (papers, assignments)
Config files (~/.ssh/config, ~/.hgrc)
April 3, 2009 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 7
VCS Tools
● cp -R project project.old● RCS● CVS● Subversion● Perforce● Visual SafeSource● ClearCase● ...
April 3, 2009 8
Distributed VCS Tools
● Mercurial● Git● Bazaar● Monotone● Darcs
● Plastic SCM● SVK● Codeville● GNU arch● Bitkeeper● ...
April 3, 2009 9
Which one?
The new “vim vs emacs”
(emacs is better)http://xkcd.com/378/
April 3, 2009 10
Mercurial
● OpenJDK● Solaris● Python● Mozilla● Netbeans
April 3, 2009 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 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 "Added a single threaded HL7 socket server."
April 3, 2009 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 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 15
But I Hate the Command Line
TortoiseHg
April 3, 2009 16
But I Hate the Command Line
MercurialEclipse
April 3, 2009 17
Being a DVCS Dog
"On the Internet, nobody knows that you're a dog."
hgsubversion
git-svn
New Yorker, 1993
April 3, 2009 18
Hosting
● BitBucket (or GitHub for git)● Sourceforge
● hg serve● SSH● hgweb (via Apache)
April 3, 2009 19
April 3, 2009 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 21
Customizing
hgrc
Set locations, username, plugins
.hgignore
Ignore unwanted files (*.class, *.pyc, *.log)
April 3, 2009 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
top related