#lets get the latest
git pull
#lets switch to branch and do some work
git checkout -b makeSomeBugs
#do the work commit
git add .
git commit -am "introducing some bugs"
#push this for my lazy remote friend to see
git push origin makeSomeBugs
#uh .. changes on master
git pull origin master
#do some work..
git commit -am "introducing some more bugs"
git push origin makeSomeBugs
#lets switch back to master
git checkout master
git pull
#work is done, lets merge
git merge --no-ff makeSomeBugs
git push origin
#and remove the branch to never ever see it again
git push origin :makeSomeBugs
git branch -d makeSomeBugs
Run Code Online (Sandbox Code Playgroud)
各种博客来源(但它们已经相当古老)说,像mercurial这样的分支是不行的,特别是永久分支删除......
Pau*_*l S 10
我可能有一些错误,因为我可能误解了git,但假设您使用的是最新版本的Mercurial,或者如果没有,则启用书签扩展 ...
# lets get the latest
# git pull
hg pull
# lets switch to branch and do some work
# git checkout -b makeSomeBugs
hg bookmark makeSomeBugs
# do the work commit
# git add .
# git commit -am "introducing some bugs"
hg commit -m "introducing some bugs"
# push this for my lazy remote friend to see
# git push origin makeSomeBugs
hg push -B makeSomeBugs
# uh .. changes on master
# git pull origin master
hg pull
hg merge
# do some work..
# git commit -am "introducing some more bugs"
# git push origin makeSomeBugs
hg commit -m "introducing some more bugs"
hg push -B makeSomeBugs
# lets switch back to master
# git checkout master
# git pull
hg pull
hg update -C <name of master rev>
# work is done, lets merge
# git merge --no-ff makeSomeBugs
# git push origin
hg merge makeSomeBugs
hg push
# and remove the branch to never ever see it again
# (I assume you mean the label not the changesets)
# git push origin :makeSomeBugs
# git branch -d makeSomeBugs
hg bookmark -d makeSomeBugs
hg push -B makeSomeBugs
Run Code Online (Sandbox Code Playgroud)
有一些"心理模型"的差异,但我认为它非常接近.最大的一个是删除书签.您在本地删除它,然后推送它被删除.你用git做的反转顺序.
还有一个问题是你用什么来识别"主"头.如果服务器上已有书签(master例如调用),则第一行将成为第一行hg pull -B master,即第一行合并hg merge master和更新hg update -C master.一旦你第一次拉动书签,你应该更新它,而不需要明确提及它.
它几乎是相同的,除了使用Mercurial你通常不会打扰命名你的进度而只是使用匿名分支.
我会让那个沉入水中......
与git不同,如果没有与之关联的分支名称或书签,Mercurial不会"忘记"更改集,因此不需要对其进行命名,然后将其删除.在此之后,它看起来像一个非常标准的工作流程:
#lets get the latest
hg pull
#lets update to the latest and do some work
hg update
#do the work commit
hg commit -Am "introducing some bugs"
#serve this for my lazy remote friend to see
hg serve
#uh .. remote changes
hg pull
#do some work..
hg commit -Am "introducing some more bugs"
#lets pull in the latest
hg pull
#work is done, lets merge
hg merge
hg push
Run Code Online (Sandbox Code Playgroud)
如果你真的想明确跟踪匿名头,你可以选择使用书签; 当你开始(之后hg update)时,使用以下方法标记当前变更集:
hg bookmark makeSomeBugs
Run Code Online (Sandbox Code Playgroud)
当您完成(之后hg merge)时,使用以下命令删除书签:
hg bookmark -d makeSomeBugs
Run Code Online (Sandbox Code Playgroud)
您也可以为了朋友的缘故推送书签,但是......嗯.
| 归档时间: |
|
| 查看次数: |
5489 次 |
| 最近记录: |