How To Remove Remotes/origin/master After Move To Main?
The project we are using had its master
branch moved to main
, on GitLab for reasons of consistency.
Locally I had renamed the master branch to main:
git branch -m master main
This seemed to be enough until I accidentally did git checkout master
and then it recreated the master branch. Doing a git branch -a
, I see I now have the following two remotes (in addition to my other ones):
remotes/origin/main
remotes/origin/master
How do a tell the local repo to forget about remotes/origin/master
, to avoid accidentally recreating master
, when I mean to switch to the main
branch?
Answer
If the git fetch --prune
does not work, it could mean the master branch is still on GitLab remote repository side (it could have been pushed by mistake by another developer who also checkout the wrong local master
branch first)
In any case, once GitLab repository is clean, you can also add a pre-commit hook in order to prevent any future accidental checkout of the wrong branch.
Related Questions
- → Authenticate with a cookie using laravel 5.1 and jwt
- → Finding a specific GitLab tag from PHP
- → React: How to publish page on server using React-starter-kit
- → babel-loader, webpack, ES2015 modules: "Element type is invalid"
- → Create a function-attribute of a function, which is, in its turn, a method of an object literal
- → Model Validation in laravel 5.1 not working
- → GIT fatal: loose object
- → Laravel validation required rule not working
- → Axios array map callback
- → Where does this `webpack://` come from for `webpack-dev-middleware`?
- → error when trying to modify project in laravel forge
- → GitHub Pages and Jekyll content duplication and SEO issues
- → Use Laravel repositories with Datatables