首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件开发 >

Git Community Book通译 (三.三) Git索引

2012-08-25 
Git Community Book翻译 (三.三) Git索引Git Community Book翻译 (三.三)Git索引现在补充三.三备注:现在我

Git Community Book翻译 (三.三) Git索引
Git Community Book翻译 (三.三) Git索引

现在补充三.三

备注:现在我建了一专门存放本书最新译本的网站:git community book中译本.

   本章节的地址是:Git索引

以后勘误时,一般只会更新 网站 不会更新博文,谢谢:)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Git索引

Git索引是一个在你的工作目录和项目仓库间的暂存区(staging area). 有了它, 你可以把许多内容的修改一起提交(commit). 如果你创建了一个提交(commit), 那么提交的是当前索引(index)里的内容, 而不是工作目录中的内容.

查看索引

使用 linkgit:git-status[1] 命令是查看索引内容的最简单办法. 你运行 git status命令, 就可以看到: 哪些文件被暂存了(就是在你的Git索引中), 哪些文件被修改了但是没有暂存, 还有哪些文件没有被跟踪(untracked).

$>git status# On branch master# Your branch is behind 'origin/master' by 11 commits, and can be fast-forwarded.## Changes to be committed:#   (use "git reset HEAD <file>..." to unstage)##   modified:   daemon.c## Changed but not updated:#   (use "git add <file>..." to update what will be committed)##   modified:   grep.c#   modified:   grep.h## Untracked files:#   (use "git add <file>..." to include in what will be committed)##   blametree#   blametree-init#   git-gui/git-citool

如果完全掌握了索引(index), 你就一般不会丢失任何信息, 只要你记得名字描述信息(name of the tree that it described)就能把它们找回来.

同时, 你最好能对Git一些基本功能的运作原理, 和它与其它版本控制系统的区别有一个清晰的理解. 如果你在这一章没有完全理解, 我们会在后面的章节重新回顾这些主题. 好了, 下面我们要去了解如何安装, 配置和使用Git.

热点排行