Eclipse + Git - “暂存”是什么意思?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/676450/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Eclipse + Git - what does "staged" mean?
提问by freiksenet
After working for some time with SVN I decided to try git with my new django project and installed the plugin for it into eclipse. I made a new pydev project and added django initial project files to the src directory. Then I "shared" the project to Git, added and commited all files. Now I have strange problems - all files except "manage.py" are "up to date" and manage.py has a strange icon that means it is "staged". What does this mean? I tried to google for it, but without success. :(
在使用 SVN 工作一段时间后,我决定在我的新 django 项目中尝试使用 git,并将其插件安装到 eclipse 中。我创建了一个新的 pydev 项目并将 django 初始项目文件添加到 src 目录。然后我将项目“共享”到 Git,添加并提交了所有文件。现在我遇到了奇怪的问题——除了“manage.py”之外的所有文件都是“最新的”,manage.py 有一个奇怪的图标,表示它是“暂存”的。这是什么意思?我试图用谷歌搜索它,但没有成功。:(
Thanks beforehand.
先谢谢了。
回答by VonC
It means your file has been added to the index.
这意味着您的文件已添加到索引中。
As described in The Thing About Git
The Index is also sometimes referred to as The Staging Area.
索引有时也称为集结区。
I tend to think of it as the next patch:
You build it up interactively with changes from your working copy and can later review and revise it.
When you're happy with what you have lined up in the staging area, which basically amounts to a diff, you commit it. And because your commits are no longer bound directly to what's in your working copy, you're free to stage individual pieces on a file-by-file, hunk-by-hunk basis.
我倾向于将其视为下一个补丁:
您可以使用工作副本中的更改以交互方式构建它,然后可以查看和修改它。
当您对暂存区域中排列的内容感到满意时,这基本上相当于一个差异,您就提交了它。 并且因为您的提交不再直接绑定到您的工作副本中的内容,所以您可以在逐个文件、逐个块的基础上自由地暂存各个部分。
If you look to the latest change logs of egit(the eclipse Git plugin), you will see they are still fiddling with how "staged" files are managed, se the more recent your egit plugin is, the better ;)
如果您查看egit(eclipse Git 插件)的最新更改日志,您会发现他们仍在摆弄“暂存”文件的管理方式,您的 egit 插件越新越好;)
回答by JesperE
I'd recommend that you make yourself familiar with the git command-line before embarking on using Git from inside Eclipse. The command-line is git's primary interface, and if you aren't comfortable with the different concepts such as index, push, pull, rebase, etc., then using Git from Eclipse will probably confuse you even more.
我建议您在开始从 Eclipse 内部使用 Git 之前先熟悉 git 命令行。命令行是 git 的主要界面,如果您对索引、推送、拉取、变基等不同的概念不满意,那么在 Eclipse 中使用 Git 可能会让您更加困惑。
回答by Marcin Gil
Isn't it a "+" icon? Staging area in git is when file is added to the index but not committed.
它不是一个“+”图标吗?git 中的暂存区是将文件添加到索引但未提交的时间。
From git-commit manual: "When recording your own work, the contents of modified files in your working tree are temporarily stored to a staging area called the "index" with git-add."
来自git-commit 手册:“在记录您自己的工作时,您的工作树中修改文件的内容会通过 git-add 临时存储到称为“索引”的暂存区。”
Also git-stage is an alias for git-add.
git-stage 也是 git-add 的别名。