git命令全面介绍, 可以选择中文版阅读(不过有些内容有丢失, 如果能看懂原版, 建议看原版)
创建一个版本控制的文件, 用到的这些git指令, 可以对照着手册进行阅读
- git init
- git add
- git commit
- git push
今天尝试git commit, 提示我有untracked file
有些疑惑, 于是去查看了git帮助手册
在第一章1.3 git basics 中, 了解到了git的三种状态
- committed(已提交)
- modified(已修改)
- staged(已暂存)
下面看看手册中如何解释这三个状态 - Committed means that the data is safely stored in your local database.
committed意味着数据被安全的存储在你的本地数据库中 - Modified means that you have changed the file but have not committed it to your database yet.
modified意味着你已经改变了你的文件但是还没有把改变提交到你的数据库中 - Staged means that you have marked a modified file in its current version to go into your next commit snapshot.
staged意味着对一个已修改文件的当前版本做了标记,使之包含在下次提交的快照中。(个人理解, 就是修改的文件准备好要被提交(commit)了)
由此引入 Git 项目的三个工作区域的概念:Git 仓库(the Git directory,) 工作目录( the working tree)以及暂存区域(the staging area.)。
- The Git directory is where Git stores the metadata and object database for your project. This is the most important part of Git, and it is what is copied when you clone a repository from another computer.
git directory 是 Git 用来保存项目的元数据和对象数据库的地方。 这是 Git 中最重要的部分,从其它计算机克隆仓库时,拷贝的就是这里的数据。 - The working tree is a single checkout of one version of the project. These files are pulled out of the compressed database in the Git directory and placed on disk for you to use or modify.
working tree(工作目录)是对项目的某个版本独立提取出来的内容。 这些从 Git 仓库的压缩数据库中提取出来的文件,放在磁盘上供你使用或修改。(我理解为自己电脑上本地磁盘上的文件) - The staging area is a file, generally contained in your Git directory, that stores information about what will go into your next commit. Its technical name in Git parlance is the “index”, but the phrase “staging area” works just as well.
(staging area)暂存区域是一个文件,它保存了下次将提交(commit&