官术网_书友最值得收藏!

The Raw, Blame, and History buttons

Now that we have explored how GitHub sees branches, let's take a look at some other Git functionalities that GitHub provides.

The Raw, Blame, and History buttons appear when viewing a single file of a repository. For example, let's visit the README.md file by clicking on it:

The Raw button, like the name suggests, opens the file in a raw form, meaning that any HTML formatting disappears. This is particularly useful when you want to download a single file. You will notice that many guides on the internet use this raw file format when they tell you to download something using command-line tools, such as wget or curl. If you have ever tried to download a file from GitHub and all you got was an HTML file, remember the usage of raw.

The Blame button makes use of Git's blame function. Basically, for each line of a file, Git informs you about who modified that line and when that line was modified. If you want to know more, visit https://git-scm.com/docs/git-blame.

In order to properly see how that works, I will not use our previously created README.md file, since there is not much information there to see how GitHub uses this Git function. Instead, I will use a file from another repository with more commits. Take, for example, https://github.com/gitlabhq/gitlabhq/blame/master/app/models/ability.rb, as shown in the following screenshot:

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files emailed directly to you.

Compared to invoking git blame in the terminal, you can feel the superiority of GitHub's feature. Every line of code is annotated so you can see when and what commit changed a particular line of the file and who changed it. There is also the nice little feature of hotness: Older commits get a brown line whereas newer ones are colored yellow.

Finally, the History button is nothing more than what git log does for a particular file.

主站蜘蛛池模板: 九江县| 奉贤区| 淳安县| 凤翔县| 科技| 太保市| 彭泽县| 锡林浩特市| 项城市| 呼和浩特市| 霍州市| 清苑县| 米脂县| 资中县| 星子县| 阿合奇县| 霍山县| 永嘉县| 惠水县| 紫金县| 南涧| 墨竹工卡县| 巴东县| 灵石县| 神农架林区| 沿河| 天等县| 岢岚县| 北海市| 宜昌市| 新营市| 宁城县| 石泉县| 准格尔旗| 天长市| 公安县| 申扎县| 皋兰县| 墨竹工卡县| 灵台县| 双辽市|