SlideShare ist ein Scribd-Unternehmen logo
1 von 46
Downloaden Sie, um offline zu lesen
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?

Weitere ähnliche Inhalte

Was ist angesagt?

slides.pdf
slides.pdfslides.pdf
slides.pdf
vidsvagi
 

Was ist angesagt? (10)

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

Andere mochten auch

JavaScript现代化排错实践
JavaScript现代化排错实践JavaScript现代化排错实践
JavaScript现代化排错实践
jeffz
 
LINQ Inside
LINQ InsideLINQ Inside
LINQ Inside
jeffz
 
大话程序员可用的算法
大话程序员可用的算法大话程序员可用的算法
大话程序员可用的算法
jeffz
 
The Evolution of Async Programming (GZ TechParty C#)
The Evolution of Async Programming (GZ TechParty C#)The Evolution of Async Programming (GZ TechParty C#)
The Evolution of Async Programming (GZ TechParty C#)
jeffz
 
企业开发领域的语言特性
企业开发领域的语言特性企业开发领域的语言特性
企业开发领域的语言特性
jeffz
 
使用.NET构建轻量级分布式框架
使用.NET构建轻量级分布式框架使用.NET构建轻量级分布式框架
使用.NET构建轻量级分布式框架
jeffz
 
我編譯故我在:誰說 Node.js 程式不能編成 binary
我編譯故我在:誰說 Node.js 程式不能編成 binary我編譯故我在:誰說 Node.js 程式不能編成 binary
我編譯故我在:誰說 Node.js 程式不能編成 binary
Fred Chien
 
基于原型的JavaScript面向对象编程
基于原型的JavaScript面向对象编程基于原型的JavaScript面向对象编程
基于原型的JavaScript面向对象编程
zhangdaiping
 

Andere mochten auch (20)

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

Ähnlich wie 分布式版本管理

Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
Victor Wong
 

Ähnlich wie 分布式版本管理 (20)

Git vs. Mercurial
Git vs. MercurialGit vs. Mercurial
Git vs. Mercurial
 
Mercurial
MercurialMercurial
Mercurial
 
Introduction to Git for Artists
Introduction to Git for ArtistsIntroduction to Git for Artists
Introduction to Git for Artists
 
Git workflows automat-it
Git workflows automat-itGit workflows automat-it
Git workflows automat-it
 
Take the next step with git
Take the next step with gitTake the next step with git
Take the next step with git
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
 
Fun with Github webhooks: verifying Signed-off-by
Fun with Github webhooks: verifying Signed-off-byFun with Github webhooks: verifying Signed-off-by
Fun with Github webhooks: verifying Signed-off-by
 
Matt Gauger - Git & Github web414 December 2010
Matt Gauger - Git & Github web414 December 2010Matt Gauger - Git & Github web414 December 2010
Matt Gauger - Git & Github web414 December 2010
 
Git basics with notes
Git basics with notesGit basics with notes
Git basics with notes
 
Lagos GitHub Meetup - What is Git?
Lagos GitHub Meetup - What is Git?Lagos GitHub Meetup - What is Git?
Lagos GitHub Meetup - What is Git?
 
Working with multiple git repositories
Working with multiple git repositoriesWorking with multiple git repositories
Working with multiple git repositories
 
Git Basics (Professionals)
 Git Basics (Professionals) Git Basics (Professionals)
Git Basics (Professionals)
 
Git_real_slides
Git_real_slidesGit_real_slides
Git_real_slides
 
Getting Into Git
Getting Into GitGetting Into Git
Getting Into Git
 
Git - (a) Gentle InTroduction
Git - (a) Gentle InTroductionGit - (a) Gentle InTroduction
Git - (a) Gentle InTroduction
 
Working with Git
Working with GitWorking with Git
Working with Git
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with Git
 
Git and github introduction
Git and github introductionGit and github introduction
Git and github introduction
 
Git Acquainted
Git AcquaintedGit Acquainted
Git Acquainted
 
Git: Why And How to
Git: Why And How toGit: Why And How to
Git: Why And How to
 

Mehr von jeffz

Wind.js无障碍调试与排错
Wind.js无障碍调试与排错Wind.js无障碍调试与排错
Wind.js无障碍调试与排错
jeffz
 
Jscex:案例、经验、阻碍、展望
Jscex:案例、经验、阻碍、展望Jscex:案例、经验、阻碍、展望
Jscex:案例、经验、阻碍、展望
jeffz
 
深入浅出Jscex
深入浅出Jscex深入浅出Jscex
深入浅出Jscex
jeffz
 
Mono for .NET Developers
Mono for .NET DevelopersMono for .NET Developers
Mono for .NET Developers
jeffz
 
Javascript Uncommon Programming
Javascript Uncommon ProgrammingJavascript Uncommon Programming
Javascript Uncommon Programming
jeffz
 
Jscex: Write Sexy JavaScript (中文)
Jscex: Write Sexy JavaScript (中文)Jscex: Write Sexy JavaScript (中文)
Jscex: Write Sexy JavaScript (中文)
jeffz
 
Jscex: Write Sexy JavaScript
Jscex: Write Sexy JavaScriptJscex: Write Sexy JavaScript
Jscex: Write Sexy JavaScript
jeffz
 
单点登录解决方案的架构与实现
单点登录解决方案的架构与实现单点登录解决方案的架构与实现
单点登录解决方案的架构与实现
jeffz
 
Documentation Insight技术架构与开发历程
Documentation Insight技术架构与开发历程Documentation Insight技术架构与开发历程
Documentation Insight技术架构与开发历程
jeffz
 
Windows Phone应用开发心得
Windows Phone应用开发心得Windows Phone应用开发心得
Windows Phone应用开发心得
jeffz
 
针对iPad平台的高性能网站架构
针对iPad平台的高性能网站架构针对iPad平台的高性能网站架构
针对iPad平台的高性能网站架构
jeffz
 
The Evolution of Async-Programming on .NET Platform (TUP, Full)
The Evolution of Async-Programming on .NET Platform (TUP, Full)The Evolution of Async-Programming on .NET Platform (TUP, Full)
The Evolution of Async-Programming on .NET Platform (TUP, Full)
jeffz
 
The Evolution of Async-Programming on .NET Platform (.Net China, C#)
The Evolution of Async-Programming on .NET Platform (.Net China, C#)The Evolution of Async-Programming on .NET Platform (.Net China, C#)
The Evolution of Async-Programming on .NET Platform (.Net China, C#)
jeffz
 
The Evolution of Async-Programming (SD 2.0, JavaScript)
The Evolution of Async-Programming (SD 2.0, JavaScript)The Evolution of Async-Programming (SD 2.0, JavaScript)
The Evolution of Async-Programming (SD 2.0, JavaScript)
jeffz
 
面向对象与生活
面向对象与生活面向对象与生活
面向对象与生活
jeffz
 
Windows内核技术介绍
Windows内核技术介绍Windows内核技术介绍
Windows内核技术介绍
jeffz
 

Mehr von jeffz (20)

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

Kürzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Kürzlich hochgeladen (20)

ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 

分布式版本管理

  • 2. • Visual SourceSafe • CVS/Subversion/TFS/etc. • Git/Mercurial/Bazaar/etc.
  • 4.
  • 6. or •
  • 7.
  • 8.
  • 9.
  • 10. CVS/SVN/etc. Git/Mercurial/etc. revision changeset
  • 11. ≠ • merge •
  • 12.
  • 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.
  • 17.
  • 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
  • 24.
  • 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
  • 28.
  • 29. Rose
  • 30. % 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
  • 31. % 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)
  • 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 <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
  • 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 <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
  • 34. • hg revert • hg rollback commit pull • • hg clone project peoject-experiment
  • 35.
  • 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 •
  • 38.
  • 39.
  • 40.
  • 41.
  • 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