Thread (10 messages) flat view 10 messages, 3 authors, 2021-04-29

RE: how to rename remote branches, the long way

From: Felipe Contreras <hidden>
Date: 2021-04-24 03:46:58

Antoine Beaupré wrote:
On 2021-04-23 20:08:49, Felipe Contreras wrote:
quoted
Antoine Beaupré wrote:
quoted
Before people start throwing things (like `git push origin oldref:newref
:oldref`) at me, consider that I've been beating my head against this
for a while, and everywhere I look basically suggests this:

    git branch -m to_branch
    git push origin from_branch:to_branch :from_branch
Better:

  git push origin from_branch:to_branch :from_branch &&
  git branch -m from_branch to_branch
How so?
If the remote branch can't be renamed, then the local branch isn't
renamed either.
quoted
quoted
I wrote this primarily with the "master to main" migration, because a
bunch of projects (including mine) are suddenly, actually migrating
their main branch from master to main. Personnally, it's because I'm
tired of being yelled "master" from my shell prompt all the time, but
naturally, I guess opinions on the matter vary.
Just tell git to stop bothering you:

  git config --global init.defaultbranch master
I think you misunderstood me; I am tired of seeing the name "master"
everywhere.
I see.

That makes me think we might want a converter that translates
(local)main -> (remote)master, and (remote)master -> (local)mail
everywhere, so if your eyes have trouble seeing one, you can configure
git to simply see the other... Without bothering the rest of the word.

I'll give that idea a try.

Cheers.

-- 
Felipe Contreras
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help