Git help needed: update local repo to specific branch or tag
Miklos Vajna
vmiklos at collabora.co.uk
Mon Sep 18 09:20:04 UTC 2017
Hi,
On Fri, Sep 15, 2017 at 06:33:17PM +0200, Stephan Bergmann <sbergman at redhat.com> wrote:
> >if [ ... ]; then
> > git fetch --prune --tags origin
> > # cleanup all patched stuff - probably not needed
> > git reset --hard
> > git checkout --detached "origin/${my_gitbranch?}"
Whether the above git fetch will put origin's master branch to
origin/master or master (the later case is what you call "tags and
branches behave the same way") depends on the refspec of the remote
named "origin", which is configured when the "origin" remote is created.
Depending on 'git remote add' was invoked with the --mirror=fetch
option (either directly or via 'git clone --mirror') .git/config
contains something like:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
(normal case, master is available as origin/master)
or
[remote "origin"]
fetch = +refs/*:refs/*
(mirror case)
So if the refspec is set up correctly, you should be able to
transparently use tags/branches the same way.
(Normally it's valuable that origin's master is written to
origin/master, so your local master branch does not change when you do
'git fetch', that's why --mirror=fetch is not the default.)
Regards,
Miklos
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20170918/18217d08/attachment.sig>
More information about the LibreOffice
mailing list