Getting Started with (Distributed) Version Control

3,145 views

Published on

Published in: Technology
1 Comment
8 Likes
Statistics
Notes
No Downloads
Views
Total views
3,145
On SlideShare
0
From Embeds
0
Number of Embeds
230
Actions
Shares
0
Downloads
81
Comments
1
Likes
8
Embeds 0
No embeds

No notes for slide

Getting Started with (Distributed) Version Control

  1. 1. Getting Started with (Distributed) Version Control Because what other tools have a blame command? John Paulett jhcore.com April 3, 2009 1
  2. 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. 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. 4. Backup quot;The Photoshop keygen gave me a virus.quot; Sharing files between computers April 3, 2009 4
  5. 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. 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
  7. 7. VCS Tools cp -R project project.old ● RCS ● CVS ● Subversion ● Perforce ● Visual SafeSource ● ClearCase ● ... ● April 3, 2009 7
  8. 8. Distributed VCS Tools Mercurial Plastic SCM ● ● Git SVK ● ● Bazaar Codeville ● ● Monotone GNU arch ● ● Darcs Bitkeeper ● ● ... ● April 3, 2009 8
  9. 9. Which one? The new “vim vs emacs” http://xkcd.com/378/ (emacs is better) April 3, 2009 9
  10. 10. Mercurial OpenJDK ● Solaris ● Python ● Mozilla ● Netbeans ● April 3, 2009 10
  11. 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. 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. 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. 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. 15. But I Hate the Command Line TortoiseHg April 3, 2009 15
  16. 16. But I Hate the Command Line MercurialEclipse April 3, 2009 16
  17. 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
  18. 18. Hosting BitBucket (or GitHub for git) ● Sourceforge ● hg serve ● SSH ● hgweb (via Apache) ● April 3, 2009 18
  19. 19. April 3, 2009 19
  20. 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. 21. Customizing hgrc Set locations, username, plugins .hgignore Ignore unwanted files (*.class, *.pyc, *.log) April 3, 2009 21
  22. 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

×