As we saw in previous posts of this series Commits are the first-class citizens in Git worlds, not the Branches . But, branch names do show up in our commit messages and a few more places. Moreover, build-pipelines and other agile tools are often set up to refer to branch names with predetermined patterns. Therefore, organizations set up some nomenclature around branch naming. Branch naming strategies are not the topic of this post, the topic is, how to change the branch name if it's not adhering to your organization's standards. Create the problem Let's first set up our problem case. Let's say we have a repo named git-renaming in local as well as remote Let's create a feature branch and name it incorrectly git checkout -b feature/master-incorrect-name Let's commit a new file in this branch echo “file1” >> file1 && git add file1 && git commit -m “second commit” Let's push this branch with the wrong name to remote. git push ...
Explore more at my website