In this post, I will introduce some useful snippets related to Git. I will update this post from time to time.
Rename Local Branches
Say you want to rename the branch old-name to new-name locally.
git checkout old-name git branch -m new-name # -m: move/rename a branch and its reflog
Rename Local & Remote Branches
Say you want to rename the branch old-name to new-name locally, then push it to remote and delete the original remote brach.
git checkout old-name git branch -m new-name git push origin :old-name # <+><source>:<destination> # git push origin :old-name means make origin old-name empty git push --set-upstream origin new-name