If you ever need to Rename a branch which has also been pushed to the remote, you can follow the following steps:
1. Rename Local Branch
If you are on the branch you want to rename, you can use following command:
git branch -m <new_branch_name>
If you are on a different branch, then use the following command:
git branch -m <old_branch_name> <new_branch_name>
2. Delete the Old_Name Branch and Push the New_Name Branch
git push origin :<old_branch_name> <new_branch_name>
3. Reset the UpStream Branch for the New_Name Local Branch
git push origin -u <new_branch_name>
No comments:
Post a Comment