@kyanny's blog

大作を傑作と混同するものは確かに鑑賞上の物質主義である。大作は手間賃の問題にすぎない - 芥川竜之介

GitHub: あるファイルの変更が取り込まれた Pull Request の一覧を得る

git log--first-parent オプションを使えばできる。

  • git log --oneline --first-parent activerecord/activerecord.gemspec
  • tig --first-parent activerecord/activerecord.gemspec

どういう話かというと、

あるファイルの変更履歴は git log path/to/file で追える。ファイル名の変更も追跡したいなら git log --follow path/to/file でだいたいいける。

一方、 GitHub Flow を採用しているコードベースの場合に、「どの Pull Request で変更されたか」を知りたいことがある。そのときどうすればいいか、という話。

で、結論、 git log --first-parent path/to/file でだいたいいける。このへんの話が近い感じ。このスライドもわかりやすい。

git log のデフォルト出力だと長くて見づらいので git log --oneline --first-parent path/to/file などとするとよい。

tig を使っている場合は tig --first-parent path/to/file が便利。さらに hub コマンドをインストールして以下のカスタマイズをすると o キーで GitHub 上のページをさくさく開けるのでもっと便利(Pull Request の URL 自体を開くにはもうワンクリック必要だが)。

blog.kyanny.me

https://github.com/rails/rails/blob/master/activerecord/activerecord.gemspec でやってみた例。

git log --oneline activerecord/activerecord.gemspec

bdfffd1355 Update the Rails mailing list URLs to new discuss discourse URL [ci skip]
493edf044f Add bug tracker/documentation/mailing list URIs to the gemspecs
027e492b6f Fix links in gemspec and docs from http to https.
647d7e6167 Revert "Revert "Merge pull request #34387 from yhirano55/rails_info_properties_json""
f66a977fc7 Revert "Merge pull request #34387 from yhirano55/rails_info_properties_json"
1b7c3222e8 Require Ruby 2.5 for Rails 6.
e74fdbe00c Amend CVE note and security guide section wordings
1c11688b56 Add CVE note to security guide and gemspecs
17ca17072d Merge Arel into Active Record
d4eb0dc89e Rails 6 requires Ruby 2.4.1+
0ea8e7db1a Remove support to Ruby 2.2
2e0fe5928f Use released arel
089ca520e3 Require alpha arel
831be98f9a Use frozen-string-literal in ActiveRecord
87b3e226d6 Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
cfade1ec7e Enforce frozen string in Rubocop
3e6ce1cd69 Add source code and changelog links to gemspecs
40bdbce191 Define path with __dir__
e646bad5b7 Remove deprecated support to passing a column to #quote
adca8154c6 applies new string literal convention in the gemspecs
1eb27fafa9 revises the homepage URL in the gemspecs [ci skip]
b611350e7c Use released arel
32f7491808 Upgrade to Ruby 2.2.2
f0768eba28 Target Ruby 2.2.1 in gemspecs
2223f49157 Require Arel 7.0.0.alpha
d3b098b828 Require Ruby 2.2 for Rails 5.0
96d0f751f9 Bump required Ruby version to 2.1.0
25c85cb6f6 Use released arel
c747d4c48c Use released arel
cc9091c3e7 Use released arel
f2003834c8 Arel master is 6.0.0
18be17ac43 Use the released arel gem
a6f58a535e use arel `master` and update activerecord to depend on arel `5.0.0`.
3cc7223f3d Remove depreacted finders
9848e8916f Bump activerecord-deprecated_finders. Fixes #10304
c072fcadd2 Bump arel to 4.0.0
88150e8622 activerecord-deprecated_finders 1.0.0 has a bug with has_many :through associations
ca4bfa23a1 Bump activerecord-deprecated_finders to 1.0.0
ddd2c75b26 Revert "instruct RDoc to only parse Ruby files under lib [Fixes #9779]"
c24528fbc9 instruct RDoc to only parse Ruby files under lib [Fixes #9779]
aac00ed9c5 bumping arel
bd36f185a8 Are was release
5f412956cf Less strict activerecord-deprecated_finders version
5937bd02de Undeprecate the :extend option
8110035623 Revert "Omit directories from gemspec.files for RubyGems 2 compat."
bb8923dee0 Omit directories from gemspec.files for RubyGems 2 compat.
a96a176930 Clean up gemspecs
17bb324f38 Renaming active_record_deprecated_finders to activerecord-deprecated_finders
6c7b250ac0 Add license field to gemspecs, by Matt Griffin
dd2c9b9578 add active_record_deprecated_finders as a dep
66b7eb1927 bumping up arel
63dc9b46b1 Fix GH #4909. Dependency on TZInfo move from AR to AS.
488c9ef64c moving to arel 3.0.0
e883c06a4f Updated gemspec for ruby 1.9.3
b6105b0b59 updating arel and journey dependencies
be9d3a2008 Bump Arel
1679aa56f3 Synchronize the gemspecs since CHANGELOG has been renamed to CHANGELOG.md
03a045b306 Bump arel dependency
4f8801963c Okay, the new incompatible arel is now called 2.2 and the sun shines upon thee once more
5870291425 Bump arel version
a2a7a19d26 Bump up rack-cache and tzinfo
1c23887ab0 Bump ARel to 2.1.3
64d977359d Add the MIT-LICENSE to the Active Record gemspec
f72f591c8c Not updating rubyforge for new versions. Result of "gem list -d rails" is not useful.
a898df66e4 bumping arel requirement
bd4831d699 Bump up rack-cache, tzinfo and thor
e14e696e96 fixing arel requirements for released arel
99da42c299 Gem::Specification#has_rdoc= is deprecated since rubygems 1.7.0
ceef719924 Bump Arel up to 2.0.2
e3d6434dd9 depending on arel 2.0.0
ef572cad0a Bump arel to 1.0.1
33afaa446f Depend on ARel 1.0 w/ tiny fixes
3409f2c691 Depend on latest arel RC
b91dcb63d0 Bump up tzinfo to 0.3.23
d16c5cc99b Change some missing README -> README.rdoc
fcb230144b Bump up nokogiri, memcache-client, sqlite3-ruby, fcgi, mail and tzinfo
d103c73d95 Bump Arel to 0.4.0
c8e2ec07a2 Unforce tzinfo from AS
d956003fa4 Neat and tidy, I say
a8b93d7a05 Bump to arel 0.3.3 to resolve Active Support dep
e260d5fbcf Require Arel 0.3.2
c5ff181480 Use arel 0.3.1, for srs
275df55106 Bump arel dep to 0.3.0+
4bc2cbc3cf Load RAILS_VERSION relative to the gemspec file.
deb00bcb8c Read Rails version from a file instead of modifying the load path and doing requires
56ea20605a Wordsmith gem descriptions
f221a6f19f Leverage VERSION constants from gemspecs to avoid tedious updates when releasing
5fe3dc4bf5 Adding ruby version spec to all gemspec files to at least 1.8.7
c548e21365 Bump git versions to 3.0.0.beta1 since we've released
a81a2a29ab Bump arel dep
031139bb71 Homogenize gemspecs and remove the deprecated autorequire
79817aa9e7 Move to 3.0.0.beta
9bd0422dd7 Bump arel dependency to 0.2.0 from 0.2.pre
a4aa95ba0c Bump AR.gemspec Arel dep too
66c4f28bd6 Bump arel requirement to 0.1.1
4cbd3f050b Move from git submodule to gem bundle
f430d6b63e Make gemspecs the authoritative source instead of generating them from the Rakefile
bd53ebde72 Add required dependencies on activemodel
67f5d611f5 Add rake gemspec and gemspecs to the repo

git log --oneline --first-parent activerecord/activerecord.gemspec

3391494207 Merge pull request #38864 from abhaynikam/replace-mailing-list-url
493edf044f Add bug tracker/documentation/mailing list URIs to the gemspecs
b075bbdc69 Merge pull request #35552 from abhaynikam/fix-remaining-set-of-links-in-gemspec
647d7e6167 Revert "Revert "Merge pull request #34387 from yhirano55/rails_info_properties_json""
f66a977fc7 Revert "Merge pull request #34387 from yhirano55/rails_info_properties_json"
04159a7a1d Merge pull request #34754 from rails/require-ruby-2.5
133e0ba33d Merge pull request #34392 from gmcgibbon/gem_security_note_amend
bb11a9acab Merge pull request #34388 from gmcgibbon/gem_security_note
989b1cb4a3 Merge pull request #32097 from matthewd/arel
d4eb0dc89e Rails 6 requires Ruby 2.4.1+
0ea8e7db1a Remove support to Ruby 2.2
2e0fe5928f Use released arel
089ca520e3 Require alpha arel
15ef55efb5 Merge pull request #29732 from kirs/frozen-activerecord
87b3e226d6 Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
3420a14590 Merge pull request #29540 from kirs/rubocop-frozen-string
cf8c46938b Merge pull request #29588 from greysteil/add-gemspec-links
4cfcf1ee54 Merge pull request #29176 from bogdanvlviv/define-path-with__dir__
2471e6391d Merge pull request #27503 from rails/activerecord-deprecation
adca8154c6 applies new string literal convention in the gemspecs
1eb27fafa9 revises the homepage URL in the gemspecs [ci skip]
b611350e7c Use released arel
33ea933d7b Merge pull request #19753 from jonatack/use-ruby-2-2-2
309ac642cb Merge pull request #19263 from splattael/target-2.2.1
2223f49157 Require Arel 7.0.0.alpha
edaab4dbe8 Merge pull request #18209 from claudiob/bump-to-2-2
86857868f8 Merge pull request #17830 from claudiob/bump-required-ruby-version
25c85cb6f6 Use released arel
9887a2cfe5 Merge branch 'master' of github.com:rails/rails
cc9091c3e7 Use released arel
f2003834c8 Arel master is 6.0.0
11e8badb16 Merge branch 'master' into set_binds
9848e8916f Bump activerecord-deprecated_finders. Fixes #10304
c072fcadd2 Bump arel to 4.0.0
88150e8622 activerecord-deprecated_finders 1.0.0 has a bug with has_many :through associations
ca4bfa23a1 Bump activerecord-deprecated_finders to 1.0.0
ddd2c75b26 Revert "instruct RDoc to only parse Ruby files under lib [Fixes #9779]"
c24528fbc9 instruct RDoc to only parse Ruby files under lib [Fixes #9779]
aac00ed9c5 bumping arel
bd36f185a8 Are was release
5f412956cf Less strict activerecord-deprecated_finders version
5937bd02de Undeprecate the :extend option
8110035623 Revert "Omit directories from gemspec.files for RubyGems 2 compat."
bb8923dee0 Omit directories from gemspec.files for RubyGems 2 compat.
fd16cb3f59 Merge pull request #8147 from gbchaosmaster/gemspec
17bb324f38 Renaming active_record_deprecated_finders to activerecord-deprecated_finders
92fd2120cd Merge pull request #6462 from grosser/feature/licenses
dd2c9b9578 add active_record_deprecated_finders as a dep
66b7eb1927 bumping up arel
e0cba3a0fa Merge branch 'master' into instance_reader
488c9ef64c moving to arel 3.0.0
e5916862a1 Merge pull request #4071 from rahul100885/rahul100885_work
b6105b0b59 updating arel and journey dependencies
26c542ba2c Merge pull request #3701 from arunagw/arel_bump
0fcf8bfbe9 Merge pull request #3516 from cesario/fix_gemspec
03a045b306 Bump arel dependency
4f8801963c Okay, the new incompatible arel is now called 2.2 and the sun shines upon thee once more
5870291425 Bump arel version
a2a7a19d26 Bump up rack-cache and tzinfo
506b2dad55 Merge pull request #1871 from guilleiguaran/arel-2-1-3
f116a4835b Merge pull request #1299 from cesario/mit-license
26703f4905 Merge pull request #1165 from arunagw/rubyforge_remove
a898df66e4 bumping arel requirement
bd4831d699 Bump up rack-cache, tzinfo and thor
e14e696e96 fixing arel requirements for released arel
99da42c299 Gem::Specification#has_rdoc= is deprecated since rubygems 1.7.0
ceef719924 Bump Arel up to 2.0.2
e3d6434dd9 depending on arel 2.0.0
d37a65307d Merge josevalim/deprecations branch.
33afaa446f Depend on ARel 1.0 w/ tiny fixes
3409f2c691 Depend on latest arel RC
0c75ec51a9 Merge remote branch 'rails/master'
d16c5cc99b Change some missing README -> README.rdoc
fcb230144b Bump up nokogiri, memcache-client, sqlite3-ruby, fcgi, mail and tzinfo
751f79a033 Merge remote branch 'rails/master'
cae2519900 Merge branch 'master' of github.com:rails/rails
0dd3eac967 Merge branch 'master' of git://github.com/rails/rails
b4c91de946 Merge remote branch 'rails/master'
e68bfaf1fe Merge remote branch 'mainstream/master'
965fe59bff Merge branch 'master' of github.com:lifo/docrails
8260f0b40f Merge remote branch 'mainstream/master'
535ae3b946 Merge branch 'master' of github.com:lifo/docrails
5446d5cb05 Merge remote branch 'mainstream/master'
dd2779e1b8 Merge commit 'mainstream/master'
340be9bddd Merge commit 'mainstream/master'