I'm just starting to use branches with git, and I created yesterday a branch foo
and pushed it to the remote. Today I wanted to work on it from home, so after running a pull I typed without thinking git checkout -b foo
.
I know I shouldn't have added the -b
option, because I got a message Switched to a new branch 'foo'
and none of the code I wrote yesterday shows up in my folders so I figure I accidentally messed up the branch names.
I tried renaming the branch using git branch -m foo bar
hoping that it would deal with the local branch only and deduplicate the branch names, but alas git checkout foo
issued the message error: pathspec 'foo' did not match any file(s) known to git.
How can I retrieve the branch I created yesterday?