gpt4 book ai didi

Git 和 Mercurial : what would be equivalent of Git workflow in Mercurial?

转载 作者:IT王子 更新时间:2023-10-29 01:00:51 25 4
gpt4 key购买 nike

#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

各种博客资源(但它们已经很老了)说在 mercurial 中像这样分支是不行的,尤其是永久分支删除...

最佳答案

我可能有一些错误,因为我可能误解了 git,但假设您使用的是最新版本的 Mercurial,或者如果不是,则 bookmarks extension已启用...

# 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

存在一些“心智模型”差异,但我认为它们非常接近。最大的一个是当您删除书签时。您在本地删除它,然后推送它已被删除。与您使用 git 时的顺序相反。

还有一个问题是您使用什么来识别“主”头。如果服务器上已经有一个书签(例如称为 master),第一行将变为 hg pull -B master,第一个 merge hg merge master 和更新 hg update -C master。一旦您第一次提取书签,任何后续的提取或推送都应该更新它,而无需明确提及。

关于Git 和 Mercurial : what would be equivalent of Git workflow in Mercurial?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10302637/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com