FreeBSD の追従は git pull -v --rebase が便利2021年04月08日 11時29分15秒

FreeBSD が 13.0-RELEASE 前に git に移行したので、現在 RC を追うのに releng/13.0 ブランチを追従している。

svn up はデフォルトで、更新したファイルを並べてくれたが、git merge や git rebase ではそれが無い。FreeBSD だとコミットの数が多いので更新毎にどのファイルが変更されたのかを見たいのだ。

git merge と git rebase では、手元の変更の追従の仕方の違い。git rebase は手元のコミットを常に上流のコミットの後に来るように再配置する。git merge だと、手元のコミットの後に毎回上流のコミットを追加して足していき、merge コミットを目印として入れる形になる。

git rebase を使うか git merge を使うかは、個人やチームの好みがあるので、各々の使い勝手の良さで決めれば良いと思っている派。しかし、FreeBSD ではコミット権限が無いので、PR や review を投げれば、そのうち取り込んでくれるかも知れないのが現状。そのため、merge を行うと古い変更が他の変更の山に埋もれて見つけられない。rebase と使うと、自分の変更が最後に来るので、管理がやりやすい。

RC5 から RC5-p1 へ git pull --rebase を行った例。-v のお蔭でカーネルにのみ変更が入ったのが判るので、make buildkernel だけで済む。

% git pull --rebase upstream releng/13.0 -v
POST git-upload-pack (336 bytes)
POST git-upload-pack (943 bytes)
POST git-upload-pack (gzip 2543 to 1315 bytes)
remote: Enumerating objects: 10, done.
remote: Counting objects: 100% (10/10), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 16 (delta 5), reused 5 (delta 5), pack-reused 6
Unpacking objects: 100% (16/16), 47.65 KiB | 163.00 KiB/s, done.
From https://git.freebsd.org/src
 * branch                    releng/13.0 -> FETCH_HEAD
   f8a134d0ef1..273977acb0a  releng/13.0 -> upstream/releng/13.0
Changes from f8a134d0ef1d430efb24b4e6bd6cd58a07ebc376 to 273977acb0aa4b999b851c85d8ce44db0ade1b44:
 UPDATING             |  7 +++++++
 sys/conf/newvers.sh  |  2 +-
 sys/kern/vfs_mount.c |  6 +++---
 sys/vm/vm_fault.c    | 29 +++++++++++++++++++++++++----
 4 files changed, 36 insertions(+), 8 deletions(-)
Warning: you are leaving 19 commits behind, not connected to
any of your branches:

  f9fe66b8840 systat: Implemented per-process swap display on -swap.
  c33e0a9c53a systat: Stop displaying total if there is one swap devise.
  0778bc1d6fa systat: Handle SIGWINCH to properly window resizing and adjust -swap disk stat based on new size.
  189612a6ad9 systat: use SYSTAT_CMD to declare common API functions.
 ... and 15 more.

If you want to keep them by creating a new branch, this may be a good time
to do so with:

 git branch <new-branch-name> f9fe66b8840

HEAD is now at 273977acb0a Add UPDATING entries and bump version
Rebasing (1/19)
Rebasing (2/19)
Rebasing (3/19)
Rebasing (4/19)
Rebasing (5/19)
Rebasing (6/19)
Rebasing (7/19)
Rebasing (8/19)
Rebasing (9/19)
Rebasing (10/19)
Rebasing (11/19)
Rebasing (12/19)
Rebasing (13/19)
Rebasing (14/19)
Rebasing (15/19)
Rebasing (16/19)
Rebasing (17/19)
Rebasing (18/19)
Rebasing (19/19)
 UPDATING | 7 +++++++
 1 file changed, 7 insertions(+)
Successfully rebased and updated detached HEAD.

コメント

コメントをどうぞ

※メールアドレスとURLの入力は必須ではありません。 入力されたメールアドレスは記事に反映されず、ブログの管理者のみが参照できます。

※なお、送られたコメントはブログの管理者が確認するまで公開されません。

名前:
メールアドレス:
URL:
コメント:

トラックバック

このエントリのトラックバックURL: http://uyota.asablo.jp/blog/2021/04/08/9365139/tb

※なお、送られたトラックバックはブログの管理者が確認するまで公開されません。