Skip to content

Instantly share code, notes, and snippets.

@lttlrck
Created March 18, 2014 20:34
Show Gist options
  • Save lttlrck/9628955 to your computer and use it in GitHub Desktop.
Save lttlrck/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
@aramodi
Copy link

aramodi commented Nov 21, 2020

First time I saw a gist with three lines having 2k stars lol

@sangeethkumarn
Copy link

Thank you so much

@Mohitmadhav
Copy link

Thanks a lot !! Worked smoothly

@SynCap
Copy link

SynCap commented Jul 28, 2021

@vishalbandre
Copy link

Thanks, great. It works as expected.

@Rakesh-space
Copy link

Thanks you

@bidehalaxmi
Copy link

Thank you

@sunnycs121
Copy link

Very helpful. Thank you so much!

@adedoyin-paystack
Copy link

Thank you very much

@HaSS-1
Copy link

HaSS-1 commented Mar 29, 2022

you pusted this solution 8 years ago ... but still working like a charm. ✅

@Al-Mutawakkil
Copy link

Thank You so much!

@au-kirkwang
Copy link

Very helpful. Thank you so much!

@lorenzogrv
Copy link

Thanks! (again) ❤️

@Rayhan-khan-Ridoy
Copy link

thanks...its working

@deSp44
Copy link

deSp44 commented Nov 30, 2022

Thanks!

@Kaleyemijowurolo
Copy link

awesome

@codewithmanas
Copy link

Thanks!

@AdarshGaur01
Copy link

Thanks. It worked like a charm.

@jriegner
Copy link

Thanks!

@Alan052918
Copy link

Thanks!

@renehu-gd
Copy link

Great!

@JohannSuarez
Copy link

Still works, thanks a lot!

@hulopza
Copy link

hulopza commented Oct 3, 2023

Helped a bunch, thanks!

@kal40
Copy link

kal40 commented Oct 4, 2023

Thanks!

@mmhg-hamed
Copy link

Perfect, thanks

@lissethamc
Copy link

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

@timuretis
Copy link

👑

@GilShalit
Copy link

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