Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Jan 2021 15:29:38 -0800
From:      Mark Millard <marklmi@yahoo.com>
To:        =?utf-8?Q?Ulrich_Sp=C3=B6rlein?= <uqs@freebsd.org>
Cc:        Milan Obuch <freebsd-git@dino.sk>, freebsd-git@freebsd.org
Subject:   Re: git setup/usage question
Message-ID:  <00F58366-4178-458E-8865-E1A2E5324EB4@yahoo.com>
In-Reply-To: <YBHTTg9mMYSRsPKO@acme.spoerlein.net>
References:  <20210126151017.4a9dd711@zeta.dino.sk> <YBHTTg9mMYSRsPKO@acme.spoerlein.net>

next in thread | previous in thread | raw e-mail | index | archive | help


On 2021-Jan-27, at 12:55, Ulrich Sp=C3=B6rlein <uqs at freebsd.org> =
wrote:

> On Tue, 2021-01-26 at 15:10:17 +0100, Milan Obuch wrote:
>> . . .
>> # git -C /mnt/src/.git fetch
>> remote: Enumerating objects: 5, done.
>> remote: Counting objects: 100% (5/5), done.
>> remote: Compressing objects: 100% (5/5), done.
>> remote: Total 5 (delta 0), reused 0 (delta 0), pack-reused 0
>> Unpacking objects: 100% (5/5), 42.60 KiB | 484.00 KiB/s, done.
>> =46rom https://git.freebsd.org/src
>> * branch                    HEAD       -> FETCH_HEAD
>>=20
>> This time there is something new... I need a merge now.
>>=20
>> # git -C /mnt/src/.git merge
>> fatal: this operation must be run in a work tree
>=20
> No, you don't want to merge. Why would you merge? You want to run `git =
pull`, that will pull the updates from the remote refs into your local =
refs.

QUOTE from https://git-scm.com/docs/git-pull :
git pull is shorthand for git fetch followed by git merge FETCH_HEAD
END QUOTE (other wording for the likes of --rebase not quoted)

Looks to me like he tried to do something like what
git pull does, but in two explicit, separate steps:
git fetch and git merge .

>>=20
>> I am a bit stuck now. What does it mean 'being in a work tree'? Doing
>> 'cd /mnt/src/main' or similar before git command does not change
>> anything. I read 'man git-merge' but still no clue. It must be
>> something simple, I just do not see it.
>>=20
>> Also,
>>=20
>> # git -C /mnt/src/.git log
>>=20
>> does not show new commit yet. If I do 'git pull --ff-only' command
>> (with another git repository, created exactly the way mentioned in
>> primer) at the same time, I see new commit in log output. It looks =
like
>> log is updated on merge, not fetch, judging from my previous litlle =
bit
>> of experience with git, so this maybe should be expected, I just do =
not
>> know.
>=20
> No, the log isn't updated on `merge` (probably just sloppy wording), =
what your log does is show the log of the local ref and you haven't =
pulled anything into it yet. If you had done git log =
refs/remotes/freebsd/main (or whatever that is on a bare repo), then =
you'd have seen the updates.

He did both the git fetch and a git merge (but not a fast forward
merge). But he had cloned with --bare and:

QUOTE from https://git-scm.com/docs/git-clone :
--bare
. . . Also the branch heads at the remote are copied directly to
corresponding  local branch heads, without mapping them to
refs/remotes/origin/ . When this option is used, neither
remote-tracking branches nor the related configuration variables
are created.
END QUOTE

So things seem to be odd compared to the normal expected
type of configuration for FreeBSD.

>> So the big question - did I the right steps to achieve what I want,
>> descibed in the beginning of this mail? Is this way OK to use, or
>> should I use some other way to achieve this?
>=20
> Yep, all looks perfectly fine, except you need to run git pull to =
bring in remote changes. So usually `git fetch` to update your copy of =
the remote refs, then `git pull --rebase` to bring in the changes into =
your local copy of the ref _and_ update the checked out copy.
>=20
> You might have to tweak all that a bit though for the bare repo case =
with worktrees.
>=20

It looks to me like he is using a configuration (--bare)
outside the range FreeBSD is intending to deal with and
so he needs his own fairly-unique procedures for using
git for FreeBSD activity.

=3D=3D=3D
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?00F58366-4178-458E-8865-E1A2E5324EB4>