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

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.

主站蜘蛛池模板: 武鸣县| 丰顺县| 博野县| 庐江县| 攀枝花市| 新乡市| 涡阳县| 荥经县| 贵溪市| 淳化县| 莆田市| 兴安盟| 德清县| 建阳市| 崇礼县| 寿光市| 桂阳县| 龙南县| 翁牛特旗| 秦皇岛市| 延川县| 黑水县| 潍坊市| 厦门市| 兰坪| 灵山县| 内丘县| 耒阳市| 平原县| 称多县| 静海县| 武平县| 榆林市| 托里县| 莎车县| 巨野县| 育儿| 南充市| 曲阜市| 元氏县| 宝丰县|