---
title: "Discussion on \"Git rename branch on remote\" | Hashnode"
description: "Discussion on \"Git rename branch on remote\". It's impossible ... but, you can copy a branch then delete the old one.\nOn the remote named origin (the default name), copy the master branch in new main branch.\ngit push origin origin/master:refs/heads/main\n\nTo delete the old master branch (the : me..."
url: "https://hashnode.com/posts/git-rename-branch-on-remote/66a1f59127d3ad7cf9f5ef0d"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Git rename branch on remote](https://blog.brennetot.com/git-rename-branch-on-remote?utm_source=hashnode&utm_medium=feed)

It's impossible ... but, you can copy a branch then delete the old one. On the remote named origin (the default name), copy the master branch in new main branch. git push origin origin/master:refs/heads/main To delete the old master branch (the : me...

Jul 25, 2024 · 1 min read · blog.brennetot.com  
Read the article

-   [#git](https://hashnode.com/tag/git)
-   [#github](https://hashnode.com/tag/github)

## Written by

[Thomas Brennetot](https://hashnode.com/@Damax)

@Damax · Tokyo, Japan

  
[View profile](https://hashnode.com/@Damax)

Rails excellence with innocence

10+ years most with Ruby on Rails and JavaScript frontend and some Go. My first language is C for 3 years in university.

## Responses 1

Markdown supported · ⌘↵ to post

No responses yet.
