Outro_9

我们使用git init来创建自己的仓库,

使用git clone来复制现有仓库,

并使用git status来确定仓库的状态,

现在,你可能想直接跳转进行提交,因为没有提交的仓库并不是很有用,

但在我们开始之前,学会查看提交对我们生成自己的提交会很有帮助

因此让我们来学习如何查看现有提交,

git会自动记录创建提交时的日期和所作的内容更改,

所以你需要做的就是为提交提供详细的标题或说明,

提交频繁,说明详细,这样可以很容易地回顾这个项目,看看它是如何发展的,

你应该经常提交,并提供详细的提交说明,

但“经常”是多久一次?你又怎么知道什么才是好的提交呢?

应该在提交中包含多少文件或代码行?

要想知道什么是好的提交,最好的方法之一就是查看现有的提交,

我们将用于查看仓库历史记录的工具是git log和git show,

使用git log你可以显示有关现有提交的信息,

git log非常强大,你会经常用到它,

git show命令可以显示有关给定提交的信息,

对于这个命令,你需要向其提供提交ID,也被称为SHA,

该命令就会显示有关这一提交的信息,

这两个命令git log和git show最重要,学习如何显示仓库历史记录,

和查看特定的提交对各方面都很有用。

作出提交的人,提交的日期,

以及提交说明,这是一个简短描述,说明在这人会让剧情中作了哪些更改,

现在屏幕上只显示了前三个提交,其实上还有更多,

我怎么知道?因为这里的冒号,表明可以显示更多的输出行,

如果你熟悉命令行,就会知道,git使用less程序作为其分页器,

分页器用于翻页浏览内容,这只是命令行实现滚屏的特殊方式,

按J键或向下箭头可以一次向下滚动一行,

要向上滚动,请按K键或向上箭头,

当冒号变为单词END时,你就知道这是最后一个提交了,

要离开分页器,按下Q键即可,

If you're not used to a pager on the command line, navigating in Less can be a bit odd. Here are some helpful keys:

  • to scroll down, press
    • j or  to move down one line at a time
    • d to move by half the page screen
    • f to move by a whole page screen
  • to scroll up, press
    • k or  to move up one line at a time
    • u to move by half the page screen
    • b to move by a whole page screen
  • press q to quit out of the log (returns to the regular command prompt)

By default, this command displays:

  • the SHA
  • the author
  • the date
  • and the message

...of every commit in the repository. I stress the "By default" part of what Git displays because the git logcommand can display a lot more information than just this.

Git uses the command line pager, Less, to page through all of the information. The important keys for Less are:

  • to scroll down by a line, use j or 
  • to scroll up by a line, use k or 
  • to scroll down by a page, use the spacebar or the Page Down button
  • to scroll up by a page, use b or the Page Up button
  • to quit, use q

The article from Udacity

原文地址:https://www.cnblogs.com/weiweim/p/8647099.html