After checking out the repository by repositoryUrl the local branches may change so only the master/main branch is available.
This causes subsequent checkouts to fail, since they look for local branches. This issue is resolved by adding the setting -B to it.
From git checkout documentation:
If -B is given, <new_branch> is created if it doesn’t exist; otherwise, it is reset.
After checking out the repository by repositoryUrl the local branches may change so only the master/main branch is available. This causes subsequent checkouts to fail, since they look for local branches. This issue is resolved by adding the setting
-B
to it.From
git checkout
documentation: