Git 的典型工作流程与 Mercurial 的相比如何?
在 hginit.com 上,典型的 hg 工作流程被描述为:
1.如果您有一段时间没有这样做,请获取大家都知道的最新版本 其他正在工作:
汞拉
汞上升
2.进行一些更改
3.提交(本地)
4.重复步骤 2-3,直到获得一些您愿意的好代码
对其他人造成伤害
5.当您准备好分享时:
hg pull 来获取其他人的更改(如果 有的)
hg merge 将它们合并 进入你的
测试!以确保 合并并没有搞砸任何事情
汞 提交(合并)hg Push
我经常使用 hg,这对我来说很有意义。我刚刚开始使用 git,还没有找到任何描述像上面引用的典型工作流程的内容。我希望有人能够解释这两个工具之间工作流程的差异,并描述 git 中的典型工作流程。
On hginit.com, a typical hg workflow is described as:
1.If you haven’t done so in a while, get the latest version that everyone
else is working off of:
hg pull
hg up
2.Make some changes
3.Commit them (locally)
4.Repeat steps 2-3 until you’ve got some nice code that you’re willing to
inflict on everyone else
5.When you’re ready to share:
hg pull to get everyone else’s changes (if
there are any)
hg merge to merge them
into yours
test! to make sure the
merge didn’t screw anything up
hg
commit (the merge) hg push
I use hg pretty regularly, and this all makes sense to me. I've just started using git, and I haven't found anything that describes a typical workflow like the above quote. I was hoping someone could explain the difference in workflow between these two tools and describe a typical workflow in git.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
大致相同:
git pull
# 获取最新代码git add foo/*.rb
# 添加要提交的文件git commit -m "Made it more betta"
# 进行并描述提交git push
# 将更改推送到某个主存储库git pull
# 自动合并它能合并的内容,并显示冲突git add .
# 添加任何有冲突的内容git commit -m "与 master 合并"
git 推送
与 Mercurial 一样,您可以根据需要重复步骤 2-4;您不必在每次提交后都进行推送。
It's about the same:
git pull
# Get latest codegit add foo/*.rb
# Add files to commitgit commit -m "Made it more betta"
# Make and describe the commitgit push
# Push the changes to some master repogit pull
# Automatically merge what it can, and show conflictsgit add .
# Add whatever was conflictinggit commit -m "Merging with master"
git push
As with Mercurial you can repeat steps 2-4 as much as you like; you don't have to push after every commit.