diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index af3d15264af..eb1238a0ffa 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -1673,10 +1673,12 @@ QStringList GitClient::synchronousRepositoryBranches(const QString &repositoryUR const QString pattern = QLatin1String("\trefs/heads/"); const int pos = line.lastIndexOf(pattern); + bool headFound = false; if (pos != -1) { const QString branchName = line.mid(pos + pattern.count()); - if (line.startsWith(headSha)) { + if (!headFound && line.startsWith(headSha)) { branches[0] = branchName; + headFound = true; if (isDetached) *isDetached = false; } else {