Git is a must for most of the developers and especially web developers.
But at times we make silly mistakes cause we are human. And when you incorrectly named a branch and moved it to the remote server/repository. Then follow the below-mentioned steps before any other developer/team
member gets a chance to hop onto you and show you crap for not adapting to naming conventions correctly -
1. Rename your local branch.
If you are on the branch you want to rename:
git branch -m <new-name>
If you are on a different branch:
git branch -m <old-name> <new-name>
2. Delete the <old-name> remote branch and push the <new-name> local branch.
git push origin :<old-name> <new-name>
3. Reset the upstream branch for the <new-name> local branch.
If you are still on a different branch then switch to the new branch and then:
git push origin -u <new-name>
Read More
- https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging
- https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell
- https://www.atlassian.com/git/tutorials/using-branches
- https://www.git-tower.com/learn/git/commands/git-branch
- https://github.com/joshnh/Git-Commands
- https://github.com/Kunena/Kunena-Forum/wiki/Create-a-new-branch-with-git-and-manage-branches
- https://dev.to/levi/a-simple-git-branch-workflow-24hh
- https://stackoverflow.com/questions/4470523/create-a-branch-in-git-from-another-branch
- https://thenewstack.io/dont-mess-with-the-master-working-with-branches-in-git-and-github/