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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With