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

Re: how to rename remote branches, the long way

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Apr 24, 2021, 17:38 UTC
Message-ID
<YIRXem9ApAsqgl6D@camp.crustytoothpaste.net>
In-Reply-To
<87mttofs5t.fsf@angela.anarc.at>
On 2021-04-24 at 00:22:06, Antoine Beaupré wrote:
Show 12 quoted lines
> For local branches, that doesn't matter much: no "links" should point
> there. But git repos are, nowadays, living web sites on web servers like
> GitHub, GitLab, cgit, or whatever. You have no way of telling those
> sites "I am renaming a branch", so they don't have an opportunity of
> fixing broken links (and, incidentally, bypassing branch protection,
> although I actually use the GitLab API to workaround that problem).
> 
> So I wonder: could git remote branch renames as an operation on remotes?
> How would that look? Is that something that the git project should work
> on? Or is this something strictly reserved to the API space of git
> forges? In that case, how do I tell my gitolite server that it's okay
> to rename a branch since it doesn't have an API? :)

I think the ability to rename a branch, and to update the HEAD reference (and other symrefs) would be a nice protocol extension to add. I've considered doing this in the past, but have never gotten around to it. It's definitely a feature I'd like to see.

Show 6 quoted lines
> Or, maybe, should this script be sent as a [PATCH] instead and just be
> merged into git itself? Maybe in contrib/? I do see some Python in
> there, so I don't feel too much like an heretic... Obviously, it could
> be rewritten in C, but it would feel such a pain in the back to me... I
> already rewrote it from this shell script, which is still available
> here:

In general, Git tries to remain neutral on forges and therefore we're probably not super likely to adopt tooling that's specific to a set of forges. I do, of course, think this script has utility and serves a particular need for users, even though it's not likely that Git will host it itself.

-- 
brian m. carlson (he/him or they/them)
Houston, Texas, US
Previous: Felipe ContrerasNext: Antoine Beaupré
Message 9 of 10 in “how to rename remote branches, the long way”
  1. Antoine BeaupréApr 24, 2021
  2. Felipe ContrerasApr 24, 2021
  3. Antoine BeaupréApr 24, 2021
  4. Felipe ContrerasApr 24, 2021
  5. Antoine BeaupréApr 24, 2021
  6. Felipe ContrerasApr 29, 2021
  7. brian m. carlsonApr 24, 2021
  8. Felipe ContrerasApr 29, 2021
  9. brian m. carlsonApr 24, 2021
  10. Antoine BeaupréApr 24, 2021

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.