Re: How to rename remote branches if I only have "client access"?

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

 



Manuel Reimer <Manuel.Spam@xxxxxxxxxxxxxx> 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.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]