Skip to content

Instantly share code, notes, and snippets.

@stuart11n
Created March 18, 2014 20:34
Show Gist options
  • Select an option

  • Save stuart11n/9628955 to your computer and use it in GitHub Desktop.

Select an option

Save stuart11n/9628955 to your computer and use it in GitHub Desktop.
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@JohannSuarez
Copy link
Copy Markdown

Still works, thanks a lot!

@hulopza
Copy link
Copy Markdown

hulopza commented Oct 3, 2023

Helped a bunch, thanks!

@kal40
Copy link
Copy Markdown

kal40 commented Oct 4, 2023

Thanks!

@mmhg-hamed
Copy link
Copy Markdown

Perfect, thanks

@lissethamc
Copy link
Copy Markdown

Thank you! It worked, It only made me do my last PR again but not a big deal

@timuretis
Copy link
Copy Markdown

👑

@GilShalit
Copy link
Copy Markdown

This can be done via the GitHub site

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment