Whether to remove orphans/foreign packages before or after updating?

If the package is in the AUR, you will see the AUR text in the pamac list -m listing. If it is not in the repos or the AUR, then there will be an empty space.

You can see that in my output. I have one package (maus) that I install from GitHub using makepkg -srci, as it is not in the AUR. All of the rest of my foreign packages are from the AUR:

pamac list -m
kf6-servicemenus-reimage 2.7.0-1                AUR  72.0 kB
maus                     1.5-1                       69.2 kB
ocs-url                  3.1.0-7                AUR  133.5 kB
python-desktop-notifier  6.1.1-1                AUR  336.1 kB
qbittorrent-enhanced     5.1.3.10-1             AUR  13.9 MB
qdiskinfo-git            0.4.r15.gc4b0ba8-1     AUR  674.9 kB
qimgv-git                1.0.2.r190.g3127a2d-1  AUR  2.3 MB
qjournalctl              0.6.4-2                AUR  221.7 kB
qman                     1:1.5.1-1              AUR  222.6 kB
solunar2-git             2.0c.r14.f30d862-1     AUR  202.5 kB
traur-bin                0.4.1-1                AUR  12.4 MB
txt2html                 2.5201-2               AUR  213.4 kB
user-analysis-git        r3.72045ce-1           AUR  6.2 kB
videomerge               2.0.0-3                AUR  534.2 kB

Note though (and this is especially important for those on Stable branch due to it being a fair bit behind Arch) that a package may be moved from the Arch repos to the AUR, but that package may still be in the repos for Stable branch (and possibly Testing branch). In that case, the package may appear in Pamac as both a repo package and an AUR package.

If you are not sure about a package, before removing it run the pamac info thepackagename command to see its description, and what packages are dependent on it.

If you are still not sure, best leave it on your system. You can always ask this forum if it is safe to remove.

2 Likes