Skip to Content
実用 Git 第3版
book

実用 Git 第3版

by Prem Kumar Ponuthorai, Jon Loeliger, 萬谷 暢崇, 長尾 高弘
March 2024
Intermediate to advanced
576 pages
9h
Japanese
O'Reilly Japan, Inc.
Content preview from 実用 Git 第3版

7章差分

Gitのgit diffコマンドはUnix/Linuxのdiffと同じようにしてファイルを比較するので、git diffができることを説明する前に、Unix/Linuxのdiffユーティリティについて簡単に説明しておくとよいかもしれない。差分(diff)は、2つのファイルの間の違いをコンパクトにまとめたものである。たとえば、次の例に示すように、Unix/Linuxのdiffコマンドは、2つのファイルを与えると、双方の各行を比較し、違いをまとめて出力する。もっと正確に言えば、違いは、片方のファイルをもう片方のファイルに書き換えるために必要な変更のリストという形で出力される。この例では、ある文章の最初のバージョンがinitialで、その後改訂したバージョンがrewriteである。-uオプションを指定すると、変更点をシェアするために広く使われている標準形式であるunified diffが生成される。

$ cat initial 
Now is the time
For all good men
To come to the aid
Of their country.

$ cat rewrite 
Today is the time
For all good men
And women
To come to the aid
Of their country.

$ diff -u initial rewrite  --- initial 1867-01-02 11:22:33.000000000 -0500 +++ rewrite 2000-01-02 11:23:45.000000000 -0500 @@ -1,4 +1,5 @@ -Now is the time +Today ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

LLMのプロンプトエンジニアリング ―GitHub Copilotを生んだ開発者が教える生成AIアプリケーション開発

LLMのプロンプトエンジニアリング ―GitHub Copilotを生んだ開発者が教える生成AIアプリケーション開発

John Berryman, Albert Ziegler, 服部 佑樹, 佐藤 直生
入門 Kubernetes

入門 Kubernetes

Kelsey Hightower, Brendan Burns, Joe Beda, 松浦 隼人
Binary Hacks Rebooted ―低レイヤの世界を探検するテクニック89選

Binary Hacks Rebooted ―低レイヤの世界を探検するテクニック89選

河田 旺, 小池 悠生, 渡邉 慶一, 佐伯 学哉, 荒田 実樹, 鈴木 創, 中村 孝史, 竹腰 開, 光成 滋生, hikalium, 浜地 慎一郎

Publisher Resources

ISBN: 9784814400614Publisher Website