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

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.

主站蜘蛛池模板: 汤阴县| 普安县| 大庆市| 綦江县| 蕲春县| 南阳市| 夏津县| 乌拉特前旗| 福州市| 皋兰县| 汨罗市| 鄂托克旗| 淅川县| 手机| 深水埗区| 丹寨县| 林甸县| 宿迁市| 钟山县| 平谷区| 连云港市| 观塘区| 克什克腾旗| 东莞市| 尉犁县| 双鸭山市| 湘阴县| 新田县| 通渭县| 新宾| 铁岭市| 余干县| 沂水县| 九龙坡区| 嘉黎县| 炉霍县| 新宾| 遵义县| 通许县| 连南| 定州市|