11
#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 でのこのような分岐は、特に永続的な分岐の削除ではうまくいかないと言っています...

4

2 に答える 2

11

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

いくつかの「メンタル モデル」の違いがありますが、かなり近いと思います。最大のものは、ブックマークを削除するときです。ローカルで削除してから、削除されたことをプッシュします。git で行った順序とは逆です。

「マスター」の頭を識別するために何を使用するかという問題もあります。サーバー上にすでにブックマークがあった場合 (masterたとえば、呼び出されます)、最初の行はhg pull -B master、最初のマージhg merge master、および更新になりhg update -C masterます。ブックマークを初めてプルすると、その後のプルまたはプッシュでは、明示的に言及する必要なくブックマークが更新されます。

于 2012-04-25T08:08:58.347 に答える
5

ほとんど同じですが、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

匿名のヘッドを明示的に追跡したい場合は、オプションでブックマークを使用できます。開始時 ( の後hg update)、次を使用して現在の変更セットにラベルを付けます。

hg bookmark makeSomeBugs

完了したら ( の後hg merge)、次を使用してブックマークを削除します。

hg bookmark -d makeSomeBugs

友達のためにブックマークをプッシュすることもできますが、まあ。

于 2012-04-25T08:14:15.553 に答える