TIL #3: How to Avoid Confusion with Git Branches

Photo of Mateusz Górniak

Mateusz Górniak

Jan 22, 2018 • 2 min read

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. 


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

Photo of Mateusz Górniak

More posts by this author

Mateusz Górniak

A student of Computer Science at the Poznan University of Technology who's deeply in love with...
How to build products fast?  We've just answered the question in our Digital Acceleration Editorial  Sign up to get access

We're Netguru!

At Netguru we specialize in designing, building, shipping and scaling beautiful, usable products with blazing-fast efficiency
Let's talk business!

Trusted by:

  • Vector-5
  • Babbel logo
  • Merc logo
  • Ikea logo
  • Volkswagen logo
  • UBS_Home