文章目录
git clone
当你从服务器上git clone下来一个项目之后,你得到的不仅仅是这个远程仓库当前的状态,而且是所有历史的状态,也就是说当你在本地仓库中使用git log命令,可以查看到这个远程仓库之前的当前分支的所有的历史记录。
Every version of very file for the history of the project is pulled down by default when you run git clone.
git clone <link> <directoryname>
该命令将远程仓库放到新的文件夹 <directoryname>
git status
有关git status,没啥好讲的。重点讲解下面这个命令。
git status -s
git status -s是git status --short
的意思,是简化版本的git status
例如:
git status -s
M README
MM Rakefile
A lib/git.rb
M lib/simplegit.rb
?? LICENSE.txt
首先要注意的是左边的状态有两个。请仔细看,状态栏是两栏。(README不是状态栏)。
The left-hand column indicates the status of the staging area and the right-hand column indicates the status of the working tree.
- ??: New files that aren’t tracked have a ?? next to them
- A: new files that have been added to the staging area have an A
- M: modified files have an M
下面我逐个进行解释:
第一个文件README,modified in the working directory but not yet staged.
第二个文件Rakefile, modified, staged, and then modified again, so there are changes to it that are both staged and unstaged.
第三个文件lib/git.rb: 在工作区新建了一个文件叫做git.rb,然后staged
第四个文件:lib/simplegit.rb: 在工作区修改了文件simplegit.rb,然后staged
第五个文件:没track