SlideShare a Scribd company logo
DVCS
• Visual SourceSafe
• CVS/Subversion/TFS/etc.
• Git/Mercurial/Bazaar/etc.
Why?
•
Subversion, CVS, etc.



•
•
•
    or
•
分布式版本管理
→
分布式版本管理
CVS/SVN/etc.   Git/Mercurial/etc.



  revision         changeset
•   ≠

•   merge

•
分布式版本管理
• Mercurial   SVN
% hg
Mercurial Distributed SCM

basic commands:

 add        add the specified files on the next commit
 annotate   show changeset information by line for each file
 clone      make a copy of an existing repository
 commit     commit the specified files or all outstanding changes
 diff       diff repository (or selected files)
 export     dump the header and diffs for one or more changesets
 forget     forget the specified files on the next commit
 init       create a new repository in the given directory
 log        show revision history of entire repository or files
 merge      merge working directory with another revision
 pull       pull changes from the specified source
 push       push changes to the specified destination
 remove     remove the specified files on the next commit
 serve      start stand-alone webserver
 status     show changed files in the working directory
 summary    summarize working directory state
 update     update working directory (or switch revisions)

use "hg help" for the full list of commands or "hg -v" for details
% pwd
/Users/neo/Code/Repo/hginit

% ll
total 24
drwxr-xr-x  5 neo   staff      170   Aug 7 13:13 .
drwxr-xr-x 12 neo   staff      408   Aug 7 13:11 ..
-rw-r--r--@ 1 neo   staff     1605   Jun 26 12:23 Info.plist
-rw-r--r--@ 1 neo   staff     2907   Jun 19 16:18 global.html
-rw-r--r--  1 neo   staff     1183   Jun 12 16:22 link.png

% hg init

% ll
total 24
drwxr-xr-x  6 neo   staff      204   Aug 7 13:14 .
drwxr-xr-x 12 neo   staff      408   Aug 7 13:11 ..
drwxr-xr-x  5 neo   staff      170   Aug 7 13:14 .hg
-rw-r--r--@ 1 neo   staff     1605   Jun 26 12:23 Info.plist
-rw-r--r--@ 1 neo   staff     2907   Jun 19 16:18 global.html
-rw-r--r--  1 neo   staff     1183   Jun 12 16:22 link.png
% hg add
      adding Info.plist
      adding global.html
      adding link.png

      % hg commit




                                     % hg log
                                     changeset:     0:0ae94e57c184
% hg commit
                                     tag:           tip
Info.plist
                                     user:          "Neo Lee <neo.lee at gmail.com>"
global.html
                                     date:          Sat Aug 07 14:43:24 2010 +0800
link.png
                                     files:         Info.plist global.html link.png
committed changeset 0:0ae94e57c184
                                     description:
                                     Init commit.
分布式版本管理
% hg commit




% hg log
changeset:   1:dc12cb350527
tag:         tip
user:        "Neo Lee <neo.lee at gmail.com>"
date:        Sat Aug 07 14:54:57 2010 +0800
files:       global.html
description:
Capitalize 'ERROR' prompt.



changeset:     0:0ae94e57c184
user:          "Neo Lee <neo.lee at gmail.com>"
date:          Sat Aug 07 14:43:24 2010 +0800
files:         Info.plist global.html link.png
description:
Init commit.
% rm Info.plist
% rm link.png




% e global.html
%




% hg revert --all
reverting Info.plist
reverting link.png
reverting global.html
1.
2.
3.         commit
4.          revert
5.   (1)
% cp Info.plist Info.plist.1
% e Info.plist
% rm link.png
remove link.png? y

%   hg status
M   Info.plist
!   link.png
?   Info.plist.1

% hg diff Info.plist
diff -r dc12cb350527 Info.plist
--- a/Info.plist         Sat Aug 07 14:54:57 2010 +0800
+++ b/Info.plist         Sat Aug 07 15:07:18 2010 +0800
@@ -3,7 +3,7 @@
  <plist version="1.0">
  <dict>
         <key>Author</key>
-        <string>Neo Lee</string>
+        <string>Li Jun</string>
         <key>CFBundleDisplayName</key>
         <string>Goo.gl</string>
         <key>CFBundleIdentifier</key>
% hg log
                       changeset:   2:5ba69dac6378
                       tag:         tip
                       user:        "Neo Lee <neo.lee at gmail.com>"
% hg remove link.png
                       date:        Sat Aug 07 15:10:02 2010 +0800
removing link.png
                       files:       Info.plist Info.plist.1 link.png
                       description:
%   hg status
                       Some dirty work!
M   Info.plist
R   link.png
?   Info.plist.1
                       changeset:   1:dc12cb350527
                       user:        "Neo Lee <neo.lee at gmail.com>"
% hg add
                       date:        Sat Aug 07 14:54:57 2010 +0800
adding Info.plist.1
                       files:       global.html
                       description:
%   hg st
                       Capitalize 'ERROR' prompt.
M   Info.plist
A   Info.plist.1
R   link.png
                       changeset:     0:0ae94e57c184
                       user:          "Neo Lee <neo.lee at gmail.com>"
% hg commit
                       date:          Sat Aug 07 14:43:24 2010 +0800
                       files:         Info.plist global.html link.png
                       description:
                       Init commit.
% hg cat Info.plist


% hg cat -r 0 Info.plist


% hg diff -r 0:1 Info.plist


% hg update -r 0


% hg up -r 1


% hg up
分布式版本管理
% mkdir repo

% cd repo

% hg init

% hg serve
listening at http://8.oasis.local:8000/ (bound to *:8000)
% hg clone http://8.oasis.local:8000/ working
no changes found
updating to branch default
resolving manifests
0 files updated, 0 files merged, 0 files removed, 0 files unresolved


% cd working


% ll
total 0
drwxr-xr-x     3 neo   staff   102 Aug   7 15:49 .
drwxr-xr-x     4 neo   staff   136 Aug   7 15:49 ..
drwxr-xr-x     8 neo   staff   272 Aug   7 15:49 .hg
% hg push

Joel   pushing to http://8.oasis.local:8000/
       searching for changes
       adding changesets
       adding manifests
       adding file changes
       added 2 changesets with 2 changes to 1 files
分布式版本管理
Rose
% hg outgoing
       comparing with http://8.oasis.local:8000/
       searching for changes
       changeset:    2:689026657682
       tag:          tip
       user:         Rose M <rose@snda.com>
       date:         Mon Feb 08 15:29:09 2010 -0500

Rose   summary:      Spicier kind of chile.

       % hg push
       pushing to http://8.oasis.local:8000/
       searching for changes
       adding changesets
       adding manifests
       adding file changes
       added 1 changesets with 1 changes to 1 files
% hg outgoing
       comparing with http://8.oasis.local:8000/
       searching for changes
       changeset:    2:4ecdb2401ab4
       tag:          tip
       user:         Joel S <joel@snda.com>
       date:         Mon Feb 08 15:32:01 2010 -0500
       summary:      potato chips. No one can eat just one.
       % hg push
       pushing to http://8.oasis.local:8000/
       searching for changes
       abort: push creates new remote heads!
       (did you forget to merge? use push -f to force)


       % hg incoming

Joel   comparing with http://8.oasis.local:8000/
       searching for changes
       changeset:    3:689026657682
       tag:          tip
       parent:       1:a52881ed530d
       user:         Rose M <rose@example.com>
       date:         Mon Feb 08 15:29:09 2010 -0500
       summary:      spicier kind of chile
       % hg pull
       pulling from http://8.oasis.local:8000/
       searching for changes
       adding changesets
       adding manifests
       adding file changes
       added 1 changesets with 1 changes to 1 files (+1 heads)
       (run 'hg heads' to see heads, 'hg merge' to merge)
% hg merge
       merging guac
       0 files updated, 1 files merged, 0 files removed, 0
       files unresolved
       (branch merge, don't forget to commit)
       % hg commit -m "merge"
       % hg log
       changeset:   4:0849ca96c304
       tag:         tip
       parent:      2:4ecdb2401ab4
       parent:      3:689026657682
       user:        Joel S <joel@snda.com>
       date:        Mon Feb 08 16:07:23 2010 -0500
       summary:     merge

Joel   ... ...
       % hg out
       comparing with http://8.oasis.local:8000//
       searching for changes
       changeset:   2:4ecdb2401ab4
       ... ...
       changeset:   4:0849ca96c304
       ... ...
       % hg push
       pushing to http://8.oasis.local:8000/
       searching for changes
       adding changesets
       adding manifests
       adding file changes
       added 2 changesets with 2 changes to 1 files
Rose
  % hg pull
  pulling from http://8.oasis.local:8000/
  searching for changes
  adding changesets
  adding manifests
  adding file changes
  added 2 changesets with 2 changes to 1 files
  (run 'hg update' to get a working copy)


  % hg log


  % hg parent
  changeset:    2:689026657682
  user:         Rose H <rose@snda.com>
  date:         Mon Feb 08 15:29:09 2010 -0500
  summary:      spicier kind of chile


  % hg up
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
•
    •                 hg revert

    •                 hg rollback    commit pull


•
    •   hg clone project peoject-experiment
分布式版本管理
Backout
  % hg backout -m 'back out second change' tip

  % hg backout --merge -m 'Back out second change.' 1
  reverting myfile
  created new head
  changeset 3:abc7fd860049 backs out changeset 1:7e341ee3be7a
  merging with changeset 3:abc7fd860049
  merging myfile
  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
  (branch merge, don't forget to commit)




1st change              2nd change                3rd change
                                                                         Automated
                                                                           merge
                                                 Back-out 2nd
                                                   change
•   code base

•           pull

•         push

•         merge

•
分布式版本管理
分布式版本管理
分布式版本管理
分布式版本管理
•
•   “   ”

•
•
Subversion → Mercurial/Git?



•
•    /
References

• Mercurial: The Definitive Guide
  by Bryan O'Sullivan, http://hgbook.red-bean.com/


• Hg Init: a Mercurial tutorial
  by Joel Spolsky, http://hginit.com/top/index.html


• Git for the Lazy
  by Spheriki, http://www.spheredev.org/wiki/Git_for_the_lazy


• PeepCode Git Internals
  by Scott Chacon
Contact Me



• neo.lee@gmail.com
• @soulhacker
•
Questions?

More Related Content

PDF
Introducción a git y GitHub
PDF
How Do I Contribute?
ODP
Gerrit Code Review - The Introduction
PPTX
Introduction To Git Workshop
PDF
My Notes from https://www.codeschool.com/courses/git-real
KEY
Working with Git
PDF
Git Real
KEY
groovy & grails - lecture 12
Introducción a git y GitHub
How Do I Contribute?
Gerrit Code Review - The Introduction
Introduction To Git Workshop
My Notes from https://www.codeschool.com/courses/git-real
Working with Git
Git Real
groovy & grails - lecture 12

What's hot (10)

KEY
Gittalk
PDF
Git real slides
PDF
Assemble Your Code in Stages: Leveling Up With Pipelines
DOCX
Git github
PDF
Version Control and Git - GitHub Workshop
PDF
Spring I/O 2015 - Mum, I want to be a Groovy full-stack developer
PDF
Tool Time
PDF
slides.pdf
PDF
Juliette Reinders Folmer - Promote your open source project with GitHub Pages...
PDF
Centralize your Business Logic with Pipelines in Elixir
Gittalk
Git real slides
Assemble Your Code in Stages: Leveling Up With Pipelines
Git github
Version Control and Git - GitHub Workshop
Spring I/O 2015 - Mum, I want to be a Groovy full-stack developer
Tool Time
slides.pdf
Juliette Reinders Folmer - Promote your open source project with GitHub Pages...
Centralize your Business Logic with Pipelines in Elixir
Ad

Viewers also liked (20)

PPT
Ruby Past, Present, Future
PDF
Jscex:案例、阻碍、体会、展望
PDF
Web开发中的缓存
PDF
JavaScript现代化排错实践
PDF
LINQ Inside
PDF
大话程序员可用的算法
PDF
The Evolution of Async Programming (GZ TechParty C#)
PDF
企业开发领域的语言特性
PPTX
QML 與 C++ 的美麗邂逅
PDF
Rabbit mq簡介(上)
PDF
Storm特性
PDF
鐵道女孩向前衝-RubyKaigi心得分享
PDF
LWC15 典藏數位化-張其昀先生相關資料數位化之應用 報告人:中國文化大學圖書館 吳瑞秀館長
PDF
使用.NET构建轻量级分布式框架
PDF
臺北智慧城市專案辦公室公共住宅智慧社區服務說明書工作會議--智慧圖書館
PDF
我編譯故我在:誰說 Node.js 程式不能編成 binary
PPTX
LWC14夢醒時分:圖書館建築構想書的實踐成果 以國立臺東大學圖書館為例。報告人:國立臺東大學圖書館 吳錦範組長
PDF
Brig:Node.js + QML 華麗大冒險
PDF
計概:Programming Paradigm
PPTX
新時代圖書館大未來
Ruby Past, Present, Future
Jscex:案例、阻碍、体会、展望
Web开发中的缓存
JavaScript现代化排错实践
LINQ Inside
大话程序员可用的算法
The Evolution of Async Programming (GZ TechParty C#)
企业开发领域的语言特性
QML 與 C++ 的美麗邂逅
Rabbit mq簡介(上)
Storm特性
鐵道女孩向前衝-RubyKaigi心得分享
LWC15 典藏數位化-張其昀先生相關資料數位化之應用 報告人:中國文化大學圖書館 吳瑞秀館長
使用.NET构建轻量级分布式框架
臺北智慧城市專案辦公室公共住宅智慧社區服務說明書工作會議--智慧圖書館
我編譯故我在:誰說 Node.js 程式不能編成 binary
LWC14夢醒時分:圖書館建築構想書的實踐成果 以國立臺東大學圖書館為例。報告人:國立臺東大學圖書館 吳錦範組長
Brig:Node.js + QML 華麗大冒險
計概:Programming Paradigm
新時代圖書館大未來
Ad

Similar to 分布式版本管理 (20)

PDF
Git vs. Mercurial
PDF
Mercurial intro
PDF
GTALUG Short Talk On Mercurial
PDF
Git for beginners
PDF
Dvcs With Mercurial (No Notes)
PDF
Git tricks
PDF
Git Tricks
PPTX
Git basic stanley hsiao 2010_12_15
PDF
Mercurial Tutorial
PDF
Advanced Git Tutorial
DOC
Git major commands
PDF
Git major commands
PDF
Git for the Android Developer
PDF
Git for the Android Developer
PDF
SCM for Android Developers Using Git
PDF
Git For The Android Developer
PDF
Loading...git
PDF
Git training
KEY
Git Magic: Versioning Files like a Boss
PDF
Hg version control bioinformaticians
Git vs. Mercurial
Mercurial intro
GTALUG Short Talk On Mercurial
Git for beginners
Dvcs With Mercurial (No Notes)
Git tricks
Git Tricks
Git basic stanley hsiao 2010_12_15
Mercurial Tutorial
Advanced Git Tutorial
Git major commands
Git major commands
Git for the Android Developer
Git for the Android Developer
SCM for Android Developers Using Git
Git For The Android Developer
Loading...git
Git training
Git Magic: Versioning Files like a Boss
Hg version control bioinformaticians

More from jeffz (20)

PDF
Wind.js无障碍调试与排错
PDF
Jscex:案例、经验、阻碍、展望
PDF
深入浅出Jscex
PDF
Mono for .NET Developers
PDF
Javascript Uncommon Programming
PDF
Jscex: Write Sexy JavaScript (中文)
PDF
Jscex: Write Sexy JavaScript
PDF
单点登录解决方案的架构与实现
PDF
Documentation Insight技术架构与开发历程
PDF
Windows Phone应用开发心得
PDF
针对iPad平台的高性能网站架构
PDF
The Evolution of Async-Programming on .NET Platform (TUP, Full)
PDF
The Evolution of Async-Programming on .NET Platform (.Net China, C#)
PDF
The Evolution of Async-Programming (SD 2.0, JavaScript)
PDF
面向对象与生活
PDF
Windows内核技术介绍
PDF
响应式编程及框架
PDF
F#语言对异步程序设计的支持
PDF
大众点评网的技术变迁之路
PDF
Better Framework Better Life
Wind.js无障碍调试与排错
Jscex:案例、经验、阻碍、展望
深入浅出Jscex
Mono for .NET Developers
Javascript Uncommon Programming
Jscex: Write Sexy JavaScript (中文)
Jscex: Write Sexy JavaScript
单点登录解决方案的架构与实现
Documentation Insight技术架构与开发历程
Windows Phone应用开发心得
针对iPad平台的高性能网站架构
The Evolution of Async-Programming on .NET Platform (TUP, Full)
The Evolution of Async-Programming on .NET Platform (.Net China, C#)
The Evolution of Async-Programming (SD 2.0, JavaScript)
面向对象与生活
Windows内核技术介绍
响应式编程及框架
F#语言对异步程序设计的支持
大众点评网的技术变迁之路
Better Framework Better Life

Recently uploaded (20)

PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Spectroscopy.pptx food analysis technology
PDF
August Patch Tuesday
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
Tartificialntelligence_presentation.pptx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
A comparative analysis of optical character recognition models for extracting...
Encapsulation_ Review paper, used for researhc scholars
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Reach Out and Touch Someone: Haptics and Empathic Computing
Unlocking AI with Model Context Protocol (MCP)
gpt5_lecture_notes_comprehensive_20250812015547.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Empathic Computing: Creating Shared Understanding
Spectral efficient network and resource selection model in 5G networks
Spectroscopy.pptx food analysis technology
August Patch Tuesday
Group 1 Presentation -Planning and Decision Making .pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Tartificialntelligence_presentation.pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Accuracy of neural networks in brain wave diagnosis of schizophrenia

分布式版本管理

  • 2. • Visual SourceSafe • CVS/Subversion/TFS/etc. • Git/Mercurial/Bazaar/etc.
  • 4.
  • 6. or •
  • 8.
  • 10. CVS/SVN/etc. Git/Mercurial/etc. revision changeset
  • 11. ≠ • merge •
  • 14. % hg Mercurial Distributed SCM basic commands: add add the specified files on the next commit annotate show changeset information by line for each file clone make a copy of an existing repository commit commit the specified files or all outstanding changes diff diff repository (or selected files) export dump the header and diffs for one or more changesets forget forget the specified files on the next commit init create a new repository in the given directory log show revision history of entire repository or files merge merge working directory with another revision pull pull changes from the specified source push push changes to the specified destination remove remove the specified files on the next commit serve start stand-alone webserver status show changed files in the working directory summary summarize working directory state update update working directory (or switch revisions) use "hg help" for the full list of commands or "hg -v" for details
  • 15. % pwd /Users/neo/Code/Repo/hginit % ll total 24 drwxr-xr-x 5 neo staff 170 Aug 7 13:13 . drwxr-xr-x 12 neo staff 408 Aug 7 13:11 .. -rw-r--r--@ 1 neo staff 1605 Jun 26 12:23 Info.plist -rw-r--r--@ 1 neo staff 2907 Jun 19 16:18 global.html -rw-r--r-- 1 neo staff 1183 Jun 12 16:22 link.png % hg init % ll total 24 drwxr-xr-x 6 neo staff 204 Aug 7 13:14 . drwxr-xr-x 12 neo staff 408 Aug 7 13:11 .. drwxr-xr-x 5 neo staff 170 Aug 7 13:14 .hg -rw-r--r--@ 1 neo staff 1605 Jun 26 12:23 Info.plist -rw-r--r--@ 1 neo staff 2907 Jun 19 16:18 global.html -rw-r--r-- 1 neo staff 1183 Jun 12 16:22 link.png
  • 16. % hg add adding Info.plist adding global.html adding link.png % hg commit % hg log changeset: 0:0ae94e57c184 % hg commit tag: tip Info.plist user: "Neo Lee <neo.lee at gmail.com>" global.html date: Sat Aug 07 14:43:24 2010 +0800 link.png files: Info.plist global.html link.png committed changeset 0:0ae94e57c184 description: Init commit.
  • 18. % hg commit % hg log changeset: 1:dc12cb350527 tag: tip user: "Neo Lee <neo.lee at gmail.com>" date: Sat Aug 07 14:54:57 2010 +0800 files: global.html description: Capitalize 'ERROR' prompt. changeset: 0:0ae94e57c184 user: "Neo Lee <neo.lee at gmail.com>" date: Sat Aug 07 14:43:24 2010 +0800 files: Info.plist global.html link.png description: Init commit.
  • 19. % rm Info.plist % rm link.png % e global.html % % hg revert --all reverting Info.plist reverting link.png reverting global.html
  • 20. 1. 2. 3. commit 4. revert 5. (1)
  • 21. % cp Info.plist Info.plist.1 % e Info.plist % rm link.png remove link.png? y % hg status M Info.plist ! link.png ? Info.plist.1 % hg diff Info.plist diff -r dc12cb350527 Info.plist --- a/Info.plist Sat Aug 07 14:54:57 2010 +0800 +++ b/Info.plist Sat Aug 07 15:07:18 2010 +0800 @@ -3,7 +3,7 @@ <plist version="1.0"> <dict> <key>Author</key> - <string>Neo Lee</string> + <string>Li Jun</string> <key>CFBundleDisplayName</key> <string>Goo.gl</string> <key>CFBundleIdentifier</key>
  • 22. % hg log changeset: 2:5ba69dac6378 tag: tip user: "Neo Lee <neo.lee at gmail.com>" % hg remove link.png date: Sat Aug 07 15:10:02 2010 +0800 removing link.png files: Info.plist Info.plist.1 link.png description: % hg status Some dirty work! M Info.plist R link.png ? Info.plist.1 changeset: 1:dc12cb350527 user: "Neo Lee <neo.lee at gmail.com>" % hg add date: Sat Aug 07 14:54:57 2010 +0800 adding Info.plist.1 files: global.html description: % hg st Capitalize 'ERROR' prompt. M Info.plist A Info.plist.1 R link.png changeset: 0:0ae94e57c184 user: "Neo Lee <neo.lee at gmail.com>" % hg commit date: Sat Aug 07 14:43:24 2010 +0800 files: Info.plist global.html link.png description: Init commit.
  • 23. % hg cat Info.plist % hg cat -r 0 Info.plist % hg diff -r 0:1 Info.plist % hg update -r 0 % hg up -r 1 % hg up
  • 25. % mkdir repo % cd repo % hg init % hg serve listening at http://8.oasis.local:8000/ (bound to *:8000)
  • 26. % hg clone http://8.oasis.local:8000/ working no changes found updating to branch default resolving manifests 0 files updated, 0 files merged, 0 files removed, 0 files unresolved % cd working % ll total 0 drwxr-xr-x 3 neo staff 102 Aug 7 15:49 . drwxr-xr-x 4 neo staff 136 Aug 7 15:49 .. drwxr-xr-x 8 neo staff 272 Aug 7 15:49 .hg
  • 27. % hg push Joel pushing to http://8.oasis.local:8000/ searching for changes adding changesets adding manifests adding file changes added 2 changesets with 2 changes to 1 files
  • 29. Rose
  • 30. % hg outgoing comparing with http://8.oasis.local:8000/ searching for changes changeset: 2:689026657682 tag: tip user: Rose M <[email protected]> date: Mon Feb 08 15:29:09 2010 -0500 Rose summary: Spicier kind of chile. % hg push pushing to http://8.oasis.local:8000/ searching for changes adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files
  • 31. % hg outgoing comparing with http://8.oasis.local:8000/ searching for changes changeset: 2:4ecdb2401ab4 tag: tip user: Joel S <[email protected]> date: Mon Feb 08 15:32:01 2010 -0500 summary: potato chips. No one can eat just one. % hg push pushing to http://8.oasis.local:8000/ searching for changes abort: push creates new remote heads! (did you forget to merge? use push -f to force) % hg incoming Joel comparing with http://8.oasis.local:8000/ searching for changes changeset: 3:689026657682 tag: tip parent: 1:a52881ed530d user: Rose M <[email protected]> date: Mon Feb 08 15:29:09 2010 -0500 summary: spicier kind of chile % hg pull pulling from http://8.oasis.local:8000/ searching for changes adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) (run 'hg heads' to see heads, 'hg merge' to merge)
  • 32. % hg merge merging guac 0 files updated, 1 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) % hg commit -m "merge" % hg log changeset: 4:0849ca96c304 tag: tip parent: 2:4ecdb2401ab4 parent: 3:689026657682 user: Joel S <[email protected]> date: Mon Feb 08 16:07:23 2010 -0500 summary: merge Joel ... ... % hg out comparing with http://8.oasis.local:8000// searching for changes changeset: 2:4ecdb2401ab4 ... ... changeset: 4:0849ca96c304 ... ... % hg push pushing to http://8.oasis.local:8000/ searching for changes adding changesets adding manifests adding file changes added 2 changesets with 2 changes to 1 files
  • 33. Rose % hg pull pulling from http://8.oasis.local:8000/ searching for changes adding changesets adding manifests adding file changes added 2 changesets with 2 changes to 1 files (run 'hg update' to get a working copy) % hg log % hg parent changeset: 2:689026657682 user: Rose H <[email protected]> date: Mon Feb 08 15:29:09 2010 -0500 summary: spicier kind of chile % hg up 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  • 34. • hg revert • hg rollback commit pull • • hg clone project peoject-experiment
  • 36. Backout % hg backout -m 'back out second change' tip % hg backout --merge -m 'Back out second change.' 1 reverting myfile created new head changeset 3:abc7fd860049 backs out changeset 1:7e341ee3be7a merging with changeset 3:abc7fd860049 merging myfile 0 files updated, 1 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) 1st change 2nd change 3rd change Automated merge Back-out 2nd change
  • 37. code base • pull • push • merge •
  • 42. • • “ ” • •
  • 44. References • Mercurial: The Definitive Guide by Bryan O'Sullivan, http://hgbook.red-bean.com/ • Hg Init: a Mercurial tutorial by Joel Spolsky, http://hginit.com/top/index.html • Git for the Lazy by Spheriki, http://www.spheredev.org/wiki/Git_for_the_lazy • PeepCode Git Internals by Scott Chacon