最近有項目需要多人在異地協(xié)同開發(fā),用什么來做配置管理呢?
當(dāng)然,分布式的版本控制系統(tǒng)是首選,目前比較流行的有兩個,Git和Mercurial(hg),為了比較決策,在網(wǎng)上搜了下,在Windows下開發(fā)的話,覺得hg更方便點,尤其是有tortoiseHG,異地共享更簡單,當(dāng)然,是指針對人數(shù)不多的團隊,不是太大的項目,沒有考慮性能問題。否則,可能還是Git有優(yōu)勢,想想看Linus的作品,目前用來管理Linux Kernel的開發(fā),自然就明白了。
當(dāng)然,mercurial也不是不行,python的開發(fā)就是用mercurial在管理,具體誰更好就不討論了,關(guān)鍵是對我而言,哪個更加好用,簡便才是硬道理!
覺得最方便的就是在于TortoiseHG集成了WEB Server,這樣,在同步的時候,只要簡單地從右鍵菜單上啟動web Server,就可以把repository 發(fā)布出來,的確夠方便吧?
show 下圖片:
啟動后是這樣的:

當(dāng)然,在啟動前,你還可以把相關(guān)的參數(shù)配置一下,仔細研究下,里面的東西不少。
ps: 今天打開看了下,閱讀量一夜之間就有了不少,謝謝大家的關(guān)注,想想應(yīng)該補充下內(nèi)容,以對得起大家的時間。
如果,你的機器在防火墻后,或者是沒有公共的域名,使用WEB Serve的方式就有些不方便。當(dāng)然,有不少的免費域名可以通過3322.org或者花生殼申請賬號,并通過客戶端使用。配置工作稍微麻煩點,這里就不寫了,有興趣的朋友可以參考下其他網(wǎng)上的說明。
在這里要補充的是一個利用郵件來共享repository的途徑。
還是看圖說話,寫個簡要的梗概,具體的細節(jié)部分需要大家親自試一下才能體會得到。
1. 配置好郵箱設(shè)置
2. 發(fā)送變更

注:郵件中也可以發(fā)送patch,只是用文件附在郵件內(nèi)容中,需要手工再處理下,不推薦。
如果只是在交流溝通時用倒也方便,僅是看看,不實際合并時比較好。
3. 協(xié)作者從郵件附件中獲得:
相對而言,Git在windows上的GUI就簡陋了些,尤其是沒有簡便的web發(fā)布功能令它遜色好多---對我這個實用的懶人而言,呵呵。盡管我用Git比HG早:)

相對于這個GUI界面而言,個人覺得bash的命令行界面還更靈活些,在Linux平臺下,一些插件也使工作更加輕松和有效率。
附圖是MinGW下的Git Bash使用界面,包含有命令自動完成,幫助使用等,也還算比較方便。
附: 這是另外一個人的意見,英文的,就不翻譯了。
當(dāng)然,他也有他的道理----兼聽則明,自己根據(jù)實際需要選擇合適的才是最重要的,畢竟,有助于輕松完成項目才是最重要的。
Background and Our Needs
I first heard about distributed version control systems from Allan
Odgaard on the TextMate blog. We’ve been working for about a year on
Unison, which is a web application to develop online training. Our
development has been so fast-paced at times we’ve been forced to push
out releases more quickly than we could test them thoroughly. More than
once we’ve needed to push out a less-than-stable feature for a
high-profile client. We would later realize something wrong with the
feature, but there was no way to go back.Branching and reverting
changes in version control software is supposed to allow you to do
these things, but both are so annoying in SVN that we never actually
used either. We only kept a branch around when we wanted to make a
release and continue development in the trunk. We would never have
dared roll back any commits
Enter Distributed Version Control
Distributed Version Control promised to solve these problems for us.
We would be able to branch as often as we liked, which would then allow
us to keep branches around for longer without worrying about merging
them later.
I first looked at git, then tried mercurial (hg) for awhile, then
finally decided on git. I’m going to try to provide an unbiased review
of some of their strengths and weaknesses.
Realize that both tools are good at merging, both have strong user
communities, and they are very similar choices. I found good
comparisons hard to come by.
Mercurial
Mercurial has several advantages over git.
Excellent Documentation: The hgbook helped me to understand the concepts
Cleaner Commands: The interface requires fewer options and flags
Intuitive Commands: The names they picked for reverting changes make more sense
Windows Support: They have a full windows client, although using it to make lots of branches would get crazy fast
It also has some disadvantages
“Named
Branches” suck: They added this feature as an afterthought. The way
everyone branches is by “cloning” a repository. So, if you want to work
in a new branch, you have to make a brand new copy of everything. The
implementation of named branches simply isn’t workable
Rewriting History is difficult: hg doesn’t have the features git does here
Git
Git has its own strengths
Branching is Supreme: This is a big
one. Git lets you make new branches at any time, and lets you switch
back and forth between them in one working copy.
Remote Branches:
Git can send and receive changes from several different public
repositories. This is useful if you need to publish more than one
branch so others can download your changes.
Merging and Rewriting
History: You can squash several commits together into one big commit
when you merge, getting rid of the useless messages. You can easily
pull a new version of the code you’re working on into your experimental
branches.
Disadvantages
Slightly more confusing: There are more commands by default, and the reverting commands are hard to keep straight at first
The Wrapup
The interface to Mercurial is easier, and I like their mainstream
approach, but git is simply far better with anything advanced. I don’t
feel that Mercurial can handle making branches for each feature you are
developing, and doesn’t do a good job of pushing/pulling changes from
public repositories.
In the end, we picked Git. I’m going to revisit mercurial in another
year and see if they’ve finished adding a few more necessary features.
I wanted a DVCS in the first place so I could branch like crazy, and
Mercurial really doesn’t support it well enough.
Posted in Environs.
其實,從DVCS本身來講,我也傾向于Git,它的功能更加完善,可能有些命令不是那么直接,不太容易理解,也比較多。但考慮到一個眾多志愿者參與的項目,像Linux Kernel這樣的集市式的開發(fā)項目,Git作為一個目前來講近乎理想的方案的確為Linux的快速發(fā)展起到了很大的作用,并且,它是Linus在長期的BitKeeper使用經(jīng)驗的基礎(chǔ)上開發(fā)的,無論從需求把握的角度,還是從它的性能方面的設(shè)計考慮都有很多過人之處。
就我本人的經(jīng)驗而言,從開始做軟件開發(fā)到現(xiàn)在,也有將近10個年頭了,經(jīng)歷過幾個公司,也參與過不少的大的項目,使用過幾種商業(yè)的、或是開源的VCS,不少是被動接受的,后來自己選擇,決策用什么,算是有些經(jīng)驗,但總體來講,這些VCS是各有千秋,適用才是最好的。
從接觸的先后順序來說,依次使用過VSS、CVS、ClearCase、Perforce、SVN、Git,前段時間才聽說HG,覺得不錯,現(xiàn)在為了新的項目,臨時學(xué)了下,總體來講,一般在局域網(wǎng)環(huán)境中使用的話,我還是喜歡CVS,畢竟,這是個大家都熟悉的工具,簡單易用,也不必再為了這個工具來專門花時間來培訓(xùn)團隊人員,否則在使用過程造成的麻煩可能會帶來些不必要的開銷。 但在異地開發(fā)、或者是項目比較大,各部分難以齊頭并進的時候,DVCS系統(tǒng)才是更好的選擇,另外一種應(yīng)該選用DVCS的情況是,當(dāng)項目需要嚴(yán)格的對外發(fā)布版本控制時,選擇DVCS可以讓各小組內(nèi)部先保證小范圍的集成順利進行,這樣可以避免在用集中式版本控制系統(tǒng)時,在deadline前,出現(xiàn)大家同時提交,沖突不斷,拼命加班的情形。
如果,團隊成員學(xué)習(xí)能力都比較強,建議在局域網(wǎng)內(nèi)開發(fā)時,也選擇用Git這樣的DVCS,畢竟,個人習(xí)慣不一樣,每個人的開發(fā)速度也不同,Git強大的分支管理和歷史記錄回溯功能,可以為項目進展提供強大的靈活性,也肯定會提高整體的開發(fā)效率。
相信,以后的版本管理中,類似Git的工具將會成為主流,Git也會變得更加簡便易用的。