Andrew Fletcher published: 26 September 2023 1 minute read
Something I haven't had to do in a while is to change the name of a Git branch both local and remote.
Steps to renaming a branch
Rename your local branch:
If you are on the branch you want to rename:
git branch -m new-name
Whereas, if you're on a different branch:
git branch -m old-name new-name
Delete the old-name remote branch and push the new-name local branch:
git push origin :old-name new-name
Reset the upstream branch for the new-name local branch:
Switch to the branch and then:
git push origin -u new-name
Related articles
Andrew Fletcher
•
07 Jan 2025
Managing DDEV environment troubleshooting and setting up multiple Drupal projects
DDEV has become a popular tool for local web development, offering a streamlined approach to managing Docker-based environments. However, setting up and managing DDEV projects, particularly with the latest versions of Docker Desktop, can present challenges. This article guides you through resolving...
Andrew Fletcher
•
28 Dec 2024
Optimising file transfers by improving efficiency from cp to rsync
Transferring files between development and production environments is a critical task in the deployment process. However, I continue to come across multiple approaches that scale from awesome automation using pipelines to the basic of direct command line entry. Where the basic approaches rely on...
Andrew Fletcher
•
13 Sep 2024
Enforcing HTTPS on an Nginx server: a step-by-step guide
In today's security-conscious world, enforcing HTTPS on your web applications is no longer optional—it's essential. Whether you're dealing with government reports or routine security audits, failing to enforce HTTPS can trigger warnings that leave you scrambling for a solution.In this article, I’ll...