Last active
July 1, 2024 09:49
-
-
Save prashantdsala/759cfd6ca629451c7a2f30275adff521 to your computer and use it in GitHub Desktop.
Renaming a branch both locally and remotely:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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