Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7570989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:33:25+00:00 2026-05-30T15:33:25+00:00

I just renamed my local branch using git branch -m oldname newname but this

  • 0

I just renamed my local branch using

git branch -m oldname newname

but this only renames the local version of the branch. How can I rename the one on GitHub?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T15:33:26+00:00Added an answer on May 30, 2026 at 3:33 pm

    As mentioned, delete the old one on GitHub and re-push, though the commands used are a bit more verbose than necessary:

    git push origin :name_of_the_old_branch_on_github
    git push origin new_name_of_the_branch_that_is_local
    

    Dissecting the commands a bit, the git push command is essentially:

    git push <remote> <local_branch>:<remote_branch>
    

    So doing a push with no local_branch specified essentially means "take nothing from my local repository, and make it the remote branch". I’ve always thought this to be completely kludgy, but it’s the way it’s done.

    As of Git 1.7 there is an alternate syntax for deleting a remote branch:

    git push origin --delete name_of_the_remote_branch
    

    As mentioned by @void.pointer in the comments

    Note that you can combine the 2 push operations:

    git push origin :old_branch new_branch

    This will both delete the old branch and push the new one.

    This can be turned into a simple alias that takes the remote, original branch and new branch name as arguments, in ~/.gitconfig:

    [alias]
        branchm = "!git branch -m $2 $3 && git push $1 :$2 $3 -u #"
    

    Usage:

    git branchm origin old_branch new_branch
    

    Note that positional arguments in shell commands were problematic in older (pre 2.8?) versions of Git, so the alias might vary according to the Git version. See this discussion for details.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

just find gives me: . ./bla-bla_(11) ./bla-bla_(1) ./rename ./rename~ This find . | grep
Just trying out this IDE but it already looks better than NetBeans in terms
I just renamed my facebook application, but the Like button and the link sharer
I just need to rename JQgrid column dynamically as per user selection from a
Just for fun, I've been using python and gstreamer to create simple Linux audio
Just a quick question. If I learn how to develop apps for IPhone using
I just renamed my project and also in the project.pbxproj renamed my product to
This question is specific to capistrano, but it's a general gem question too. I
I feel like I must be missing something, but the git issues README doesn't
I have a local Git repository on my computer that I am trying to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.