All Ruby on Rails Node JS Android iOS React Native Frontend

TIL #3: How to Avoid Confusion with Git Branches


In today's TIL...

This time Git!

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

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:

  • rename the file to avoid conflicts with the branch's name
  • use more precise way to checkout to the remote branch: 

    git checkout -b release origin/release 

 

That's the comment where the right solution has been described: https://gist.github.com/markSci5/5916003#gistcomment-2007212

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.

 

Photo by Jazmin Quaynor on Unsplash

Code stories CTA
READ ALSO FROM Git
Read also
Need a successful project?
Estimate project or contact us