RE: git pull not replicating?

From: Mark Millard <marklmi_at_yahoo.com>
Date: Sat, 18 Jun 2022 17:13:50 UTC
Andy Farkas <andyf_at_andyit.com.au> wrote on
Date: Sat, 18 Jun 2022 13:57:14 UTC  :

> If I do a 'git pull' in /usr/ports usually it updates a few files
> and I think 'good, my ports tree is in sync with upstream'. And if
> I do it again shortly afterwards, I get:
> 
> root:/usr/ports # git pull
> Already up to date.
> root:/usr/ports #
> 
> Which is also good.
> 
> But if I do this:
> 
> root:/usr/ports # mv ftp /root/
> root:/usr/ports # git pull
> Already up to date.
> root:/usr/ports #
> 
> ..which is obviously false.

Nope. It just means you have made modifications
that could be checked in. (Deleting/moving directory
trees from the likes of inside /usr/ports is a
valid type of development operation. Merges
involving such are supported.) Take a
look via the likes of:

# git -C /usr/ports status

and it should show the modification to the insides
of /usr/ports in some way that I'll not get into
here.

> Now my belief that I am in sync with upstream is shattered.

"git -C /usr/ports pull" is basically a sequence
( I made the command explicit about /usr/ports ):

# git -C /usr/ports fetch
# git -C /usr/ports merge

The git fetch means that you have a full copy available
locally that you could check out into a directory tree
or force an existing tree to match (say via
"git -C /usr/ports reset --hard HEAD" use after the
fetch).

The git merge has to do with updating the local
directory tree to deal with both already-changed
local content and the fetched material. It is
not the goal of this to do the likes of a
"git -C /usr/ports reset --hard HEAD".

> Is there a git incantation that will make sure my tree is fully
> in sync with upstream?

A question here is if you maintain any deliberate
changes of your own in your tree. (Are you acting
like a developer at all?) A:

# git -C /usr/ports reset --hard HEAD

would destroy any deliberate changes to things
in your /usr/ports tree.

git is biased to on-going development and so expects
to deal with differences being involved in the local
directory tree. It is extra work to be sure no
differences occur or to remove the differences when
unintended ones show up. It is not automatic.


===
Mark Millard
marklmi at yahoo.com