symtoms:
When you trigger a git fetch, it only fetches changes in the master branch.
Even though you have pushed changes to your remote repository regarding other branches, the git fetch command doesn’t update them locally. You’ll see like git fetch does nothing.
Can receive errors when attempting to checkout
error: pathspec ‘the_new_branch_name’ did not match any file(s) known to git.
Reason:
This can be happened due to the limitations that are applied by git configs. As implied by its name Git configs are configuration values on a global or local project level for Git.
If we don’t use any options, git configs are written into the local level. Local-level configs are stored in .git/config folder inside the repository.
STEP 1 : Use the following command to check the current settings on fetch
git config --get remote.origin.fetch
Check whether your output in following manner:+refs/heads/any_branch:refs/remotes/origin/any_branch
This configuration will limit you to fetch only from the mentioned branch.
STEP 2 : You can simply edit the configuration to allow to fetch from any branch
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
This will allow you to sync every remote branch update with your local. Now you can try git fetch and it must work!!
symtoms: When you trigger a git fetch, it only fetches changes in the master branch. Even though you have pushed changes to your remote repository regarding other branches, the git fetch command doesn’t update them locally. You’ll see like git fetch does nothing. Can receive errors when attempting to checkout error: pathspec ‘the_new_branch_name’ did not match any file(s) known to git.
Reason: This can be happened due to the limitations that are applied by git configs. As implied by its name Git configs are configuration values on a global or local project level for Git.
If we don’t use any options, git configs are written into the local level. Local-level configs are stored in .git/config folder inside the repository.
STEP 1 : Use the following command to check the current settings on fetch
git config --get remote.origin.fetch
Check whether your output in following manner:+refs/heads/any_branch:refs/remotes/origin/any_branch
This configuration will limit you to fetch only from the mentioned branch.
STEP 2 : You can simply edit the configuration to allow to fetch from any branch
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
This will allow you to sync every remote branch update with your local. Now you can try git fetch and it must work!!