githubのプルリクでmasterとブランチとの差分を見た際、masterが最新ではない問題

題名のとおり。

masterが最新ではない!!

何故だと思って調べたところ、以下の理由。

 

 

git diffの".."はコミット同士の比較、"..."はマージベース(分岐点)との比較
GitHubのプルリクエストの差分はマージベースとの比較(トリプルドット)

GitHubのプルリクエストの差分はどこと比較しているか?(git diffの".."と"..."の違い) - Qiita

 

masterを取り込まずにプルリクをすると、前回masterを取り込んだ時点のmasterと比較してしまう。githubであっても。

なんでこんな仕様にしてるんだろう。

 

 

これがgithubで見た時と同じ差分(masterが古い可能性がある)

 $ git diff master...pururiku_no_buranch

 

最新のmasterと比較するときは以下(ドットが一個少ない)

$ git diff master..pururiku_no_buranch

git diffコマンドで比較する時のダブルドット(..)とトリプルドット(...)の違いとは? | Yakst

 

 

 

別途、参考情報として、

マージをするかリベースをするか、指定してくれと警告が出た場合の対処

You have divergent branches and need to specify how to reconcile them.

 

リベースせずマージの場合は以下の実行で。# merge

git config pull.rebase false 

Gitの警告"You have divergent branches and need to specify how to reconcile them."は、pull時分岐したブランチに対する設定を明確にすることで解決する。 - appbirdNotebook

 

$ git pull origin master                                                                                                  
From github.com:AAAAAA/BBBBBBRepo
 * branch              master     -> FETCH_HEAD
hint: You have divergent branches and need to specify how to reconcile them.
hint: You can do so by running one of the following commands sometime before
hint: your next pull:
hint: 
hint:   git config pull.rebase false  # merge
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only
hint: 
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
fatal: Need to specify how to reconcile divergent branches.