一、涉及到的命令以及详解
hg branch 查看当分支以及创建分支;
hg branches 查看所有的分支;
hg up(update)切换分支;
二、创建分支的目的:
branch (分支)應該也是 Hg 最重要的技能之一,在一個多人專案的開發過程中我們有時候要開發新功能,有時候是要修正某個Bug,有時候想要測試某個特異功能能不能 work ,這時候我們通常都會從主 branch 再開出一條新的 branch 來做,這支新開的 branch 會帶著你的主 branch 目前的最新狀態,當你完成你所要開發的新功能/ Bug 修正後確認沒問題就再把它 merge(合併)回主 Branch ,如此便完成了新功能的開發或是 Bug 的修正,因此每個人都可以從主 branch 拉一條新的 branch 來做自己想做的事,再來我們好好了解一下 branch 的使用。
三、创建分支的实体操作
d:\workspace\Check_Update>hg branch check //创建新分支为check marked working directory as branch check (branches are permanent and global, did you want a bookmark?) d:\workspace\Check_Update>hg commit //将新分支提交到本地仓库 d:\workspace\Check_Update>hg push --new-branch //将新分支提交到远程仓库 pushing to https://bitbucket.org/zhang_1992/check_update http authorization required realm: Bitbucket.org HTTP user: zhang_1992 password: searching for changes remote: adding changesets remote: adding manifests remote: adding file changes remote: added 1 changesets with 0 changes to 0 files remote: remote: Create pull request for check: remote: https://bitbucket.org/zhang/check_update/pull-requests/new?source =check&t=1 remote: d:\workspace\Check_Update>hg branch //查看当前分支 check d:\workspace\Check_Update>hg branches //查看所有分支 check 3:95b8a9a1dd3c default 2:b818dac73721 (inactive)
d:\workspace\Check_Update>hg branch check //创建新分支为check marked working directory as branch check (branches are permanent and global, did you want a bookmark?) d:\workspace\Check_Update>hg commit //将新分支提交到本地仓库 d:\workspace\Check_Update>hg push --new-branch //将新分支提交到远程仓库 pushing to https://bitbucket.org/zhang_1992/check_update http authorization required realm: Bitbucket.org HTTP user: zhang_1992 password: searching for changes remote: adding changesets remote: adding manifests remote: adding file changes remote: added 1 changesets with 0 changes to 0 files remote: remote: Create pull request for check: remote: https://bitbucket.org/zhang/check_update/pull-requests/new?source =check&t=1 remote: d:\workspace\Check_Update>hg branch //查看当前分支 check d:\workspace\Check_Update>hg branches //查看所有分支 check 3:95b8a9a1dd3c default 2:b818dac73721 (inactive)