git/list[1] front-page[2] threads[3] people[4] search[5] about
 

RE: moving a remote branch?

From
Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Date
Jun 17, 2010, 13:02 UTC
Message-ID
<A612847CFE53224C91B23E3A5B48BAC74483CEEB16@xmail3.se.axis.com>
In-Reply-To
<AANLkTikeLpvGA-RFBdMGblOnhNKJ6dUrpUZQlENMP51A@mail.gmail.com>
Show 20 quoted lines
> -----Original Message-----
> From: git-owner@vger.kernel.org [mailto:git-owner@vger.kernel.org] On
> Behalf Of Nazri Ramliy
> Sent: den 17 juni 2010 14:13
> To: Peter Kjellerstedt
> Cc: Thomas Anderson; git@vger.kernel.org
> Subject: Re: moving a remote branch?
> 
> On Thu, Jun 17, 2010 at 4:28 PM, Peter Kjellerstedt 
> > Renaming a remote branch is a two step operation. First you push the
> > old branch into its new name, and then you remove the old branch. It
> > can be done with these commands:
> >
> >        git push origin origin/featurea:refs/heads/featureb
> >        git push origin :featurea
> 
> I'd like to add (more confusion!:) with this clarification:
> 
> The two push operation above rename the branch on the remote side.
> It does not affect any of your local branches.

No, it does not affect any local branches, but it _does_ effect the representation of the remote branches in the local repository.

> If you do "git branch -a" then you'd still see the
> "origin/zelnaga/featurea" branch.
No, you will not (at least not with git 1.7.1 that I use). 

Neither do you need to do the two steps below as the two pushes above are enough to also keep the status of the remote branches in sync in the local repository..

Show 6 quoted lines
> Doing a "git fetch origin" will get the newly renamed branch from the
> remote repo and create a local version of it on your local repo.
> 
> At this point you can do "git branch -D origin/featurea".
> 
> nazri
//Peter
Previous: Nazri RamliyNext: Nazri Ramliy
Message 5 of 8 in “moving a remote branch?”
  1. Thomas AndersonJun 17, 2010
  2. Nazri RamliyJun 17, 2010
  3. Peter KjellerstedtJun 17, 2010
  4. Nazri RamliyJun 17, 2010
  5. Peter KjellerstedtJun 17, 2010
  6. Nazri RamliyJun 17, 2010
  7. Thomas AndersonJun 17, 2010
  8. Peter KjellerstedtJun 17, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.