During the feature branch clone, we only have the clone feature branch. However, we would like to have an option that allows us to fetch the refs/heads/ and refs/remotes/origin/ for the “main” branch.
For example, we can use the following command:
git fetch origin main:refs/remotes/origin/main
This is useful when we are performing the SonarQube scan as part of the pipeline using the maven sonar-scanner plugin in the Run Step. In this case, we get the following warning:
[WARNING] Could not find ref ‘main’ in refs/heads, refs/remotes, refs/remotes/upstream or refs/remotes/origin
By adding git fetch main:refs/remotes/origin/main before the SonarQube analysis, we were able to resolve this issue.
Created by brijesh.jagani
·