Skip to Main Content
実用 Git 第3版
book

実用 Git 第3版

by Prem Kumar Ponuthorai, Jon Loeliger, 萬谷 暢崇, 長尾 高弘
March 2024
Intermediate to advanced content levelIntermediate 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.
Start your free trial

You might also like

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

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

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

入門 Kubernetes

Kelsey Hightower, Brendan Burns, Joe Beda, 松浦 隼人
セキュアで信頼性のあるシステム構築 ―Google SREが考える安全なシステムの設計、実装、保守

セキュアで信頼性のあるシステム構築 ―Google SREが考える安全なシステムの設計、実装、保守

Heather Adkins, Betsy Beyer, Paul Blankinship, Piotr Lewandowski, Ana Oprea, Adam Stubblefield, Kuma Arakawa, 渡邉 了介

Publisher Resources

ISBN: 9784814400614Publisher Website