* How to rename remote branches if I only have "client access"?
@ 2016-10-20 15:03 Manuel Reimer
2016-10-20 15:55 ` Junio C Hamano
0 siblings, 1 reply; 2+ messages in thread
From: Manuel Reimer @ 2016-10-20 15:03 UTC (permalink / raw)
To: git
Hello,
I have the following branches on my remote repo:
new_version
master
I now want the "new_version" branch to be the "master" and the old
"master" has to be renamed to the old version number (in my case 0.2.0).
How to do this? Currently this causes me much trouble as I can't delete
the remote "master" repository as this is the "remote current repository"...
Thanks in advance
Manuel
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: How to rename remote branches if I only have "client access"?
2016-10-20 15:03 How to rename remote branches if I only have "client access"? Manuel Reimer
@ 2016-10-20 15:55 ` Junio C Hamano
0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2016-10-20 15:55 UTC (permalink / raw)
To: Manuel Reimer; +Cc: git
Manuel Reimer <Manuel.Spam@nurfuerspam.de> writes:
> I have the following branches on my remote repo:
>
> new_version
> master
>
> I now want the "new_version" branch to be the "master" and the old
> "master" has to be renamed to the old version number (in my case
> 0.2.0).
>
> How to do this?
I assume you have "git push" access into this remote repository.
You are correct that there is no way for you to tell "git push" (or
any Git native method) to rename "master" to "maint-0.2.0".
What you can do is to push the commits at the tip of "master" and
"new_version" to "maint-0.2.0" and "master" respectively, and then
delete "new_version". If the 'master' and 'new_version' you locally
have are already the 'master' and 'new_version' you have over there
that you want to see sit at the tips of updated 'maint-0.2.0' and
'master' branches, then:
git push $remote master:refs/heads/maint-0.2.0 new_version:master
git push $remote :new_version
would do this.
Note that in the <source>:<dest> syntax in "git push", the <source>
side refers to the names in your local repository; if your local
'master' is different from what you want to see at the tip of
'maint-0.2.0' at the remote after this, replace it with whatever
name you give to that commit locally in the above example.
Also note that the this push may not succeed if your new_version is
not a descendant of the current 'master' at the remote. You'd need
to use +<source>:<dest> to force it if that is the case.
The second command that has an empty <source> is to delete <dest>.
Lastly, the remote side can be configured to forbid deletion of
branches, and/or to forbid forced pushes. If your remote is
configured that way (which is not default), then there is no way for
you to do any of the above (and that is by design---the server
operators use these configuration variables to forbid you from doing
something, so you shouldn't be able to override that choice).
> Currently this causes me much trouble as I can't
> delete the remote "master" repository as this is the "remote current
> repository"...
Sorry, but you lost me here. You were talking about two branches in
a single repository that is remote earlier. I do not know what this
"remote master repository" you bring up in this paragraph is, and
why you can't remove it. Not that I want to know the answers to
these questions myself. I just do not understand these as a reason
behind your wanting to rename branches at a remote repository.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-10-20 15:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-20 15:03 How to rename remote branches if I only have "client access"? Manuel Reimer
2016-10-20 15:55 ` Junio C Hamano
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.