Skip to main content

Post creating a new branch in the repo, next step was to run the checkout command locally.  On my local environment I ran the following command

git checkout {branch-name}

However, the response was

error: pathspec '{branch-name}' did not match any file(s) known to git

 

Solution

The issue while the new branch is known in the repo, it's not known in my local environment.  To make the new branch known you need to run the fetch command

git fetch --all

Response

remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 5 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (5/5), 922 bytes | 17.00 KiB/s, done.
From https://bitbucket.org/{path}
 * [new branch]          drupal-10              -> origin/drupal-10
 * [new branch]          feature/august-release -> origin/feature/august-release
 * [new tag]             2023.06rc              -> 2023.06rc
 * [new tag]             2023.08rc              -> 2023.08rc

Now you'll be able to run the Git checkout command

git checkout drupal-10

Response

Switched to a new branch 'drupal-10'
M       content/vendor/bin/drush
branch 'drupal-10' set up to track 'origin/drupal-10'.