Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
552 views
in Technique[技术] by (71.8m points)

mercurial - Why do I need hg update after hg pull while in git I'm doing only git pull

In git to pull and use the latest changes to my local repository I'm using git pull.

In hg, I also use hg pull but it prints then

run 'hg update' to get a working copy

I do run hg update but I wonder why is this difference from git?

question from:https://stackoverflow.com/questions/19270303/why-do-i-need-hg-update-after-hg-pull-while-in-git-im-doing-only-git-pull

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The other answers don't actually answer the question, which is: why don't Git and Mercurial work the same? Is there a philosophical difference?

In Mercurial, pull is the opposite of push: it syncs the local repo with a remote repo without touching the working copy. So it's more consistent.

In Git, pull is a fetch plus a merge, or a pull plus an update in Mercurial terms. Usually this is what you want. So it's more efficient.

The Distributed Version Control University talk has a slide at the 4-minute mark that clearly demonstrates the way Mercurial works. Michael Ernst's Version control concepts and best practices has a similar diagram (included below):

Distributed version control


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...