Skip to content

Instantly share code, notes, and snippets.

@prashantdsala
Last active July 1, 2024 09:49
Show Gist options
  • Save prashantdsala/759cfd6ca629451c7a2f30275adff521 to your computer and use it in GitHub Desktop.
Save prashantdsala/759cfd6ca629451c7a2f30275adff521 to your computer and use it in GitHub Desktop.
Renaming a branch both locally and remotely:
# Rename the branch locally
git branch -m old-branch-name new-branch-name
# Push the renamed branch and set upstream
git push origin -u new-branch-name
# Delete the old branch from the remote repository
git push origin --delete old-branch-name
# Clean up local branches (optional)
git branch -d old-branch-name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment