Re: problem with git-pull

From: Jan Beich <>
Date: Fri, 15 Sep 2023 15:15:55 UTC
Matthias Apitz <> writes:

> El día miércoles, septiembre 13, 2023 a las 11:40:57 +0200, Jan Beich escribió:
>> There are but not officially[1] supported by ports/ e.g.,
>> $ rm -rf security/wpa_supplicant
>> $ git checkout origin/main security/wpa_supplicant
>> $ git commit -m '[local] security/wpa_supplicant: sync with "main" branch'
>> or ...
> Thanks, Jan.
> I've tested as a dry run for the next time your first proposal:

For a dry run use a checkout that far enough from "main" e.g.,

$ git worktree add --detach /tmp/test origin/2023Q2
$ cd /tmp/test
$ rm -rf security/wpa_supplicant
$ git checkout origin/main security/wpa_supplicant
Updated 3 paths from b36253a767e7
$ git status
M  security/wpa_supplicant/Makefile
M  security/wpa_supplicant/files/patch-src_drivers_driver__bsd.c
M  security/wpa_supplicant/files/patch-src_l2__packet_l2__packet__freebsd.c

Note, "rm -rf" is a workaround for Git not modifying files that don't
exist in the target revision. It's mostly to prevent orphaned files from
breaking build.

> $ cd ports

"git fetch" maybe needed shortly after in order to update "origin" i.e.,
discover updates on the remote side.

> nothing to commit, working tree clean
> What is the purpose of the above 'git commit ...'? It seems to not have
> any effect.

Avoid many future Git commands being blocked on dirty index e.g.,

$ git rebase origin
error: cannot rebase: Your index contains uncommitted changes.
error: Please commit or stash them.

$ git merge origin
error: Your local changes to the following files would be overwritten by merge:
  security/wpa_supplicant/Makefile security/wpa_supplicant/files/patch-src_drivers_driver__bsd.c security/wpa_supplicant/files/patch-src_l2__packet_l2__packet__freebsd.c
Merge with strategy ort failed.

$ git cherry-pick origin
error: your local changes would be overwritten by cherry-pick.
hint: commit your changes or stash them to proceed.
fatal: cherry-pick failed

$ git format-patch -1 --stdout origin | git am
fatal: Dirty index: cannot apply patches (dirty: security/wpa_supplicant/Makefile security/wpa_supplicant/files/patch-src_drivers_driver__bsd.c security/wpa_supplicant/files/patch-src_l2__packet_l2__packet__freebsd.c)
$ git am --abort