获得“阶段”的Git概念 [英] Getting Git-concept of "stage"

查看:107
本文介绍了获得“阶段”的Git概念的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



任何类比都可以用SVN来完成吗?
在Git中创建阶段级别的主要目的是什么?

解决方案

相似点:



必须添加应该成为存储库一部分的文件才能进行跟踪。这两个工具都使用 add 命令来完成此操作。添加文件意味着准备提交。



差异:



添加文件时的更多细节。您可以决定添加一个完整的文件或不同的代码行。
将文件添加到索引阶段允许更多的灵活性。 SVN会自动提交已添加到存储库的文件的所有更改。 Git将决定与用户的每个提交操作关联的更改。换句话说:无论文件的跟踪状态如何,Git中的下一个 commit 仅包含已经执行的更改(行或文件)。 SVN自动包含所有跟踪文件的变化。



其他信息: 试试阅读一些描述Git工作流的帖子,比如 Oliver Steele 。但请注意,使用Git并非一种方式 - 有很多。如果你愿意,你可以像使用SVN一样使用Git。

不要指望在短时间内理解Git的哲学。我花了一年时间才弄懂它,但我仍然在学习使用它的新方法。如果你用SVN思维方式成长起来,我觉得更难。那里有很多材料:文章,视频...... - 慢慢来,尝试其中的一些。以下是我收集的清单中的一个选项。




Still having a hard time getting my head wrapped around the concept of staging as it applies to Git.

Can any analogies be made with SVN? What is the primary purpose of having a stage level in Git?

解决方案

Similarities:

Files that should be part of the repository must be added in order to being tracked. Both tools use the add command to accomplish this. Adding files means to prepare a commit.

Differences:

Git allows some further kind of detail when adding files. You can decide to add a whole file or distinct lines of code. Adding files to the index or stage allows more flexibility. SVN automatically commits all changes on a file that has already been added to the repository. Git leaves the decision of what changes to associate with each commit operation to the user. In other words: the next commit in Git only contains those changes (lines or files) that have been staged, regardless of the tracking status of the files. SVN automatically includes all changes on tracked files.

Additional information:

Try to read some posts describing Git workflows such as the one from Oliver Steele. But be aware that there is not one way to use Git - there are many. If you want, you can use Git as if you were working with SVN.
Do not expect to understand the philosophy of Git in a short period of time. It took me a year to get into it and I still learn new ways to use it. I think it is even harder if you grew up with SVN mindset. There are tons of materials out there: articles, videos, ... - take your time and try some of them. Here is a selection from the list I collected.

这篇关于获得“阶段”的Git概念的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆