LoginSignup
4
4

More than 5 years have passed since last update.

git (github) で過去の1点と現状との差分を単一のファイルに限定して見る方法 (差分を翻訳しなおすため)

Last updated at Posted at 2015-12-16

概要

CakePHP3 のドキュメント の翻訳をしていて、
翻訳後に原文が更新されることがよくあるのですが、
どこが変わったのか diff することがよくあります。
そのときの手順をまとめてみました。

手順

  • ローカルを最新の状態にしていることが前提です。

  • 下記のようにして特定のファイルの修正の一覧を出します。

git log --date=short --pretty=format:"%h %cd %C(blue)%an:%C(white) %s" ファイルパス
$ git log --date=short --pretty=format:"%h %cd %C(blue)%an:%C(white) %s" en/orm/retrieving-data-and-resultsets.rst
32fbb58 2015-11-07 Bryan Crowe: Merge pull request #3471 from cakephp/no-easily
71d73e4 2015-11-06 Mark Story: Remove easily.
3ca071c 2015-11-04 Mark Story: Merge pull request #3467 from jeffblack360/patch-32
6835e6f 2015-11-04 JB: Update retrieving-data-and-resultsets.rst
5658a4e 2015-11-04 Graziel: typo
eb94b67 2015-10-07 cake17: remove last label warning caused by an include
cc8f581 2015-10-02 Bryan Crowe: A few fixes to contain docs
f5b1085 2015-09-24 antograssiot: update ref to collections page
c5d1419 2015-08-20 Avinash Joshi: Typo in in ...->autoFields(true);->contain...
a12da5d 2015-08-08 Mark Story: Add more collection method examples to retrieving data.

各列は順に、コミット番号、マージされた日付、コミットした人、コミット文。

自分が翻訳をし始めたあたりの日付から、最新のコミットまでを選んで最新のブランチ名(この例では 3.0 )と比較します。

git diff コミット番号 照合先ブランチ --color -U前後の行数 ファイルパス
$ git diff 75ebfe0 3.0 --color -U10 en/orm/retrieving-data-and-resultsets.rst
diff --git a/en/orm/retrieving-data-and-resultsets.rst b/en/orm/retrieving-data-and-resultsets.rst
index f82b1fe..ad5a656 100644
--- a/en/orm/retrieving-data-and-resultsets.rst
+++ b/en/orm/retrieving-data-and-resultsets.rst
@@ -3,41 +3,55 @@ Retrieving Data & Results Sets

 .. php:namespace:: Cake\ORM

 .. php:class:: Table

 While table objects provide an abstraction around a 'repository' or collection of
 objects, when you query for individual records you get 'entity' objects. While
 this section discusses the different ways you can find and load entities, you
 should read the :doc:`/orm/entities` section for more information on entities.

+Debugging Queries and ResultSets
+================================
+
+Since the ORM now returns Collections and Entities, debugging these objects can
+be more complicated than in previous CakePHP versions. There are now various
+ways to inspect the data returned by the ORM.

PHPStorm 使っているならもっと簡単

  • 対象のファイルを開く
  • Show History アイコン(image )をクリックし、 Version ControlHistroy を開く
  • 一番上(最新)と過去のいずれかのコミットを選び、 Ctrl + D で差分を表示する。

以上!

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4