Hi, On Fri, Sep 15, 2017 at 06:33:17PM +0200, Stephan Bergmann <sbergman@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
Attachment:
signature.asc
Description: Digital signature