code

How to Avoid Confusion with Git Branches

This time Git!

It’s a great tool for sure but sometimes I feel quite confused when I see the way how it works.

Git merge

This time I wanted to check out to the remote branch called release but every time I tried to do it, git just returned following error:

error: pathspec 'release' did not match any file(s) known to git.

Solution

The reason for the error described above was a file added to the repository and using the same RELEASE name - file included all the necessary commands to execute after deploying the next release.

How to solve the problem?

There are two possible ways:

You’d need to run git checkout --track origin/test (which is the same thing as running git checkout -b test origin/test)

Simple, isn’t it?


TIL, or Today I Learned, is where our developers share the best tech stuff they found every day. You can find smart solutions for some issues, useful advice and anything which will make your developer life easier.

Response to “How to Avoid Confusion with Git Branches”