[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Rename master branch to main



* Sébastien Villemot <sebastien@debian.org> [2021-08-08 22:51]:

Le dimanche 08 août 2021 à 22:44 +0200, Sébastien Villemot a écrit :
Le samedi 07 août 2021 à 16:49 +0200, Rafael Laboissière a écrit :
* Sébastien Villemot <sebastien@debian.org> [2021-08-07 11:55]:
Le vendredi 06 août 2021 à 18:11 +0200, Rafael Laboissière a écrit :
Unfortunately, I could not find a way to update an existing cloned
repository with the old branches "master" and "upstream". If someone know
how to do it, please let me know. If you have already commit to your
local master branch and not pushed them, I apologize for the
inconvinience.

The following may work (untested):

git fetch git branch --move upstream upstream/latest git branch --move master debian/latest git branch --set-upstream-to=origin/upstream/latest upstream/latest git branch --set-upstream-to=origin/debian/latest debian/latest git checkout upstream/latest git pull git checkout debian/latest git pull

Thanks, Sébastien. Your code almost fully worked. I needed just to add "git remote prune origin" before the first "git checkout" command. I added the resulting script to our admin repo [*].

I just fixed a bug in this script: the “prune” operation was done too late, hence the upstream/latest was not correctly setup to track origin/upstream/latest.

You will probably have to fix manually the local repositories that you have already converted, by running:

 git branch --set-upstream-to=origin/upstream/latest upstream/latest

There was another issue: the refs/remotes/origin/HEAD symbolic reference was not updated. I have fixed the script. The manual command to be run is:

 git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/debian/latest

Great, thanks!

Rafael


Reply to: