Prevent Git From Creating Branches That Use Names Of Remotes?
I often accidentally checkout remote tracking branches incorrectly:
git checkout -b origin/fixbugs
-b should be a
This mistake creates a branch called "origin/fixbugs". How could I get git to give me an error instead of creating this branch when the branch name begins with "origin/" (or any other remote name)?
First, you don't have to use the
-t option, since
git checkout has a guess mode.
git checkout fixbugs
<branch>is not found but there does exist a tracking branch in exactly one remote (call it
<remote>) with a matching name, and
--no-guessis not specified, treat as equivalent to:
$ git checkout -b <branch> --track <remote>/<branch>
- it has the same guess mode as
git checkout, so a simple
git switch fixbugsis enough.
- if has a
-toption, but no
-boption, so you would get an error in this case!
- → 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