LoginSignup
2
1

More than 3 years have passed since last update.

GitHubの差分確認方法(ブランチ、コミット、日付)

Posted at

GitHub実践入門の「ブランチ間の差分確認方法」のあたりを読んでいて、「確かコミット間でも比較できたよな」と思い、少し調べました。備忘録として残しておきます。

なお、今回の例として使用するリポジトリは下記のnumpyリポジトリです。
https://github.com/numpy/numpy/

差分が大きすぎると、コミットなどが表示されるだけですが、そんなに大きくなければファイル内の細かい差分も見れました(commit間の比較部分の参考URLが分かりやすいと思います)。

1. ブランチ間の比較

https://github.com/[ユーザー(組織)名]/[リポジトリ名]/compare/branch1...branch2
例. https://github.com/numpy/numpy/compare/master...maintenance/1.1.x

2. コミット間の比較

https://github.com/[ユーザー(組織)名]/[リポジトリ名]/compare/コミットハッシュ値1...コミットハッシュ値2
例. https://github.com/numpy/numpy/compare/b01a473...4d29079

3. 日付での比較

3.1. n日前

https://github.com/[ユーザー(組織)名]/[リポジトリ名]/compare/branch@{7.day.ago}...branch
例. https://github.com/numpy/numpy/compare/master@{7.day.ago}...master

3.2. 指定日

https://github.com/[ユーザー(組織)名]/[リポジトリ名]/compare/branch@{YYYY-MM-DD}...branch
例. https://github.com/numpy/numpy/compare/master@{2020-12-01}...master

異なる分類での比較

上記のような形でURLを編集することで、ブランチとコミットの比較や日付とブランチの比較など、様々な比較が可能になっている。
試すにはcompare/以降の...の両端の組み合わせを変えるだけでいい。
https://github.com/[ユーザー(組織)名]/[リポジトリ名]/compare/branch@{7.day.ago}...コミットハッシュ値
https://github.com/[ユーザー(組織)名]/[リポジトリ名]/compare/branch...コミットハッシュ値

2
1
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
2
1