summaryrefslogtreecommitdiff
path: root/doc/user/project/repository/branches/default.md
diff options
context:
space:
mode:
Diffstat (limited to 'doc/user/project/repository/branches/default.md')
-rw-r--r--doc/user/project/repository/branches/default.md34
1 files changed, 32 insertions, 2 deletions
diff --git a/doc/user/project/repository/branches/default.md b/doc/user/project/repository/branches/default.md
index a1ea929bb49..5cd025f017d 100644
--- a/doc/user/project/repository/branches/default.md
+++ b/doc/user/project/repository/branches/default.md
@@ -11,8 +11,9 @@ When you create a new [project](../../index.md), GitLab creates a default branch
in the repository. A default branch has special configuration options not shared
by other branches:
+- It cannot be deleted.
- It's [initially protected](../../protected_branches.md#protected-branches) against
- accidental deletion and forced pushes.
+ forced pushes.
- When a merge request uses an
[issue closing pattern](../../issues/managing_issues.md#closing-issues-automatically)
to close an issue, the work is merged into this branch.
@@ -97,7 +98,7 @@ Ensure they understand the scope of this change includes references to the old
branch name in related code and scripts.
When changing the default branch name for an existing repository, you should preserve
-the history of your default branch by renaming it, instead of deleting it. This example
+the history of your default branch by renaming it, instead of creating a new branch. This example
renames a Git repository's (`example`) default branch.
1. On your local command line, navigate to your `example` repository, and ensure
@@ -195,3 +196,32 @@ To fix the problem:
```
1. In GitLab, [change the default branch](#change-the-default-branch-name-for-a-project) to the one you intend to use.
+
+### Query GraphQL for default branches
+
+You can use a [GraphQL query](../../../../api/graphql/index.md)
+to retrieve the default branches for all projects in a group.
+
+To return all projects in a single page of results, replace `GROUPNAME` with the
+full path to your group. GitLab returns the first page of results. If `hasNextPage`
+is `true`, you can request the next page by replacing the `null` in `after: null`
+with the value of `endCursor`:
+
+```graphql
+{
+ group(fullPath: "GROUPNAME") {
+ projects(after: null) {
+ pageInfo {
+ hasNextPage
+ endCursor
+ }
+ nodes {
+ name
+ repository {
+ rootRef
+ }
+ }
+ }
+ }
+}
+```