7

According to How to reset my local repository to be just like the remote repository HEAD you can set your local branch to match the remote branch by

git reset --hard origin/<branch_name>

which works fine for branches that don't have slashes in their names.

For my remote branch 'topic/something' with the command

git reset --hard origin/topic/something

I get the following error:

fatal: ambiguous argument 'origin/topic/something': unknown revision or path not in the working tree.

What is the correct syntax for branch names containing slashes? Thanks.

Community
  • 1
  • 1
Jakob Wanner
  • 119
  • 7
  • 2
    … is it even possible to have a branch name containing slashes? Are you sure you don’t just want `topic/something`? – Ry- Jul 21 '14 at 17:07
  • What does `git branch -a` show? What about `git rev-parse origin/topic/something`? And, @minitech: sure, slashes in branch names are fine. – torek Jul 21 '14 at 18:05

1 Answers1

3

I found what was missing. I only did

git fetch origin topic/something

before I tried the git reset --hard command. But I needed to do

git fetch --all

as well. Then

git reset --hard origin/topic/something

worked. Thanks for your help.

Jakob Wanner
  • 119
  • 7