Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/doc/user
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-12-11 03:07:38 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-12-11 03:07:38 +0300
commit4148df7b7365f1817aa657c9ffc7e3bc96bd738a (patch)
treeb152827d663dd45b142ccbea212bfa358f4c8801 /doc/user
parent1e4a2eca1fb7b405a82b5eccfdb0203c77d1c4e2 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/user')
-rw-r--r--doc/user/project/merge_requests/conflicts.md101
-rw-r--r--doc/user/project/merge_requests/img/conflict_section.pngbin72815 -> 0 bytes
-rw-r--r--doc/user/project/merge_requests/img/conflict_section_v16_7.pngbin0 -> 32753 bytes
-rw-r--r--doc/user/project/merge_requests/img/conflicts_v16_7.pngbin0 -> 10637 bytes
-rw-r--r--doc/user/project/merge_requests/img/merge_conflict_editor.pngbin50286 -> 0 bytes
-rw-r--r--doc/user/project/merge_requests/img/merge_conflict_editor_v16_7.pngbin0 -> 13729 bytes
-rw-r--r--doc/user/project/merge_requests/img/merge_request_widget.pngbin8936 -> 0 bytes
7 files changed, 54 insertions, 47 deletions
diff --git a/doc/user/project/merge_requests/conflicts.md b/doc/user/project/merge_requests/conflicts.md
index d61753c3b40..f3fd38bdcef 100644
--- a/doc/user/project/merge_requests/conflicts.md
+++ b/doc/user/project/merge_requests/conflicts.md
@@ -6,18 +6,39 @@ info: To determine the technical writer assigned to the Stage/Group associated w
# Merge conflicts **(FREE ALL)**
-_Merge conflicts_ happen when the two branches in a merge request (the source and target) each have different
+Merge conflicts happen when the two branches in a merge request (the source and target) each have different
changes, and you must decide which change to accept. In a merge request, Git compares
the two versions of the files line by line. In most cases, GitLab can merge changes
together. However, if two branches both change the same lines, GitLab blocks the merge,
-and you must choose which change you want to keep.
+and you must choose which change you want to keep:
-A merge request cannot merge until you either:
+![A merge request blocked due to a merge conflict](img/conflicts_v16_7.png)
+
+A merge request with conflicts cannot merge until you either:
- Create a merge commit.
- Resolve the conflict through a rebase.
-![Merge request widget](img/merge_request_widget.png)
+GitLab resolves conflicts by creating a merge commit in the source branch, but
+does not merge it into the target branch. You can then review and test the
+merge commit. Verify it contains no unintended changes and doesn't break your build.
+
+## Understand the conflict block
+
+When Git detects a conflict that requires a decision on your part, it marks the
+beginning and end of the conflict block with conflict markers:
+
+- `<<<<<<< HEAD` marks the beginning of the conflict block.
+- Your changes are shown.
+- `=======` marks the end of your changes.
+- The latest changes in the target branch are shown.
+- `>>>>>>>` marks the end of the conflict.
+
+When you resolve a conflict, you delete:
+
+1. The version of the conflicted lines you don't want to keep.
+1. The three conflict markers: the beginning, the end, and the `=======` line between
+ the two versions.
## Conflicts you can resolve in the user interface
@@ -38,23 +59,23 @@ criteria, you must resolve the conflict manually.
GitLab does not detect conflicts when both branches rename a file to different names.
For example, these changes don't create a conflict:
-1. On branch `a`, doing `git mv example.txt example1.txt`
-1. On branch `b`, doing `git mv example1.txt example3.txt`.
+1. Branch `one` renames `example.txt` to `example1.txt`
+1. Branch `two` renames `example.txt` to `example_old.txt`.
-When these branches merge, both `example1.txt` and `example3.txt` are present.
+When these branches merge, both `example1.txt` and `example_old` are present.
## Methods of resolving conflicts
GitLab shows [conflicts available for resolution](#conflicts-you-can-resolve-in-the-user-interface)
in the user interface, and you can also resolve conflicts locally through the command line:
-- [Interactive mode](#resolve-conflicts-in-interactive-mode): UI method best for
+- **Interactive mode**: UI method best for
conflicts that only require you to select which version of a line to keep, without edits.
-- [Inline editor](#resolve-conflicts-in-the-inline-editor): UI method best for more complex conflicts that require you to
+- **Inline editor**: UI method best for more complex conflicts that require you to
edit lines and manually blend changes together.
-- [Command line](#resolve-conflicts-from-the-command-line): provides complete control over the most complex conflicts.
+- **Command line**: provides complete control over the most complex conflicts.
-## Resolve conflicts in interactive mode
+### In interactive mode
To resolve less-complex conflicts from the GitLab user interface:
@@ -62,14 +83,15 @@ To resolve less-complex conflicts from the GitLab user interface:
1. Select **Code > Merge requests** and find the merge request.
1. Select **Overview**, and scroll to the merge request reports section.
1. Find the merge conflicts message, and select **Resolve conflicts**.
- GitLab shows a list of files with merge conflicts. The conflicts are
+ GitLab shows a list of files with merge conflicts. The lines that conflict are
highlighted:
- ![Conflict section](img/conflict_section.png)
+ ![Conflict section](img/conflict_section_v16_7.png)
+
1. For each conflict, select **Use ours** or **Use theirs** to mark the version
of the conflicted lines you want to keep. This decision is known as
"resolving the conflict."
-1. Enter a **Commit message**.
+1. When you've resolved all of the conflicts, enter a **Commit message**.
1. Select **Commit to source branch**.
Resolving conflicts merges the target branch of the merge request into the
@@ -77,27 +99,35 @@ source branch, using the version of the text you chose. If the source branch is
`feature` and the target branch is `main`, these actions are similar to running
`git switch feature; git merge main` locally.
-## Resolve conflicts in the inline editor
+### In the inline editor
-Some merge conflicts are more complex, requiring you to manually modify lines to
-resolve their conflicts. Use the merge conflict resolution editor to resolve complex
-conflicts in the GitLab interface:
+Some merge conflicts are more complex, and you must manually modify lines to
+resolve their conflicts. The merge conflict resolution editor helps you resolve
+these complex conflicts in the GitLab interface:
1. On the left sidebar, select **Search or go to** and find your project.
-1. Select **Code > Merge requests** and find the merge request.
+1. Select **Merge requests** and find the merge request.
1. Select **Overview**, and scroll to the merge request reports section.
1. Find the merge conflicts message, and select **Resolve conflicts**.
GitLab shows a list of files with merge conflicts.
-1. Select **Edit inline** to open the editor:
- ![Merge conflict editor](img/merge_conflict_editor.png)
+1. Find the file to edit manually, and scroll to the conflict block.
+1. In the header for that file, select **Edit inline** to open the editor. In this
+ example, the conflict block begins at line 1350 and ends at line 1356:
+
+ ![Merge conflict editor](img/merge_conflict_editor_v16_7.png)
+
1. After you resolve the conflict, enter a **Commit message**.
1. Select **Commit to source branch**.
-## Resolve conflicts from the command line
+### From the command line
While most conflicts can be resolved through the GitLab user interface, some are too complex.
Complex conflicts are best fixed locally, from the command line, to give you the
-most control over each change:
+most control over each change.
+
+Prerequisites:
+
+- You must have permission to force push to branches.
1. Open the terminal and check out your feature branch. For example, `my-feature-branch`:
@@ -114,12 +144,7 @@ most control over each change:
```
1. Open the conflicting file in your preferred code editor.
-1. Find the conflict block:
- - It begins with the marker: `<<<<<<< HEAD`.
- - Next, it displays your changes.
- - The marker `=======` indicates the end of your changes.
- - Next, it displays the latest changes in the target branch.
- - The marker `>>>>>>>` indicates the end of the conflict.
+1. Find the conflict block.
1. Edit the file:
1. Choose which version (before or after `=======`) you want to keep.
1. Delete the version you don't want to keep.
@@ -153,25 +178,7 @@ most control over each change:
1. [Force-push](../../../topics/git/git_rebase.md#force-pushing) the changes to your
remote branch.
-## Merge commit strategy
-
-GitLab resolves conflicts by creating a merge commit in the source branch, but
-does not merge it into the target branch. You can then review and test the
-merge commit. Verify it contains no unintended changes and doesn't break your build.
-
## Related topics
- [Introduction to Git rebase and force-push](../../../topics/git/git_rebase.md)
- [Git applications for visualizing the Git workflow](https://git-scm.com/downloads/guis)
-
-<!-- ## Troubleshooting
-
-Include any troubleshooting steps that you can foresee. If you know beforehand what issues
-one might have when setting this up, or when something is changed, or on upgrading, it's
-important to describe those, too. Think of things that might go wrong and include them here.
-This is important to minimize requests for support, and to avoid doc comments with
-questions that you know someone might ask.
-
-Each scenario can be a third-level heading, for example `### Getting error message X`.
-If you have none to add when creating a doc, leave this section in place
-but commented out to help encourage others to add to it in the future. -->
diff --git a/doc/user/project/merge_requests/img/conflict_section.png b/doc/user/project/merge_requests/img/conflict_section.png
deleted file mode 100644
index cfc17013218..00000000000
--- a/doc/user/project/merge_requests/img/conflict_section.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/merge_requests/img/conflict_section_v16_7.png b/doc/user/project/merge_requests/img/conflict_section_v16_7.png
new file mode 100644
index 00000000000..40701e46b50
--- /dev/null
+++ b/doc/user/project/merge_requests/img/conflict_section_v16_7.png
Binary files differ
diff --git a/doc/user/project/merge_requests/img/conflicts_v16_7.png b/doc/user/project/merge_requests/img/conflicts_v16_7.png
new file mode 100644
index 00000000000..1de03b5cfe0
--- /dev/null
+++ b/doc/user/project/merge_requests/img/conflicts_v16_7.png
Binary files differ
diff --git a/doc/user/project/merge_requests/img/merge_conflict_editor.png b/doc/user/project/merge_requests/img/merge_conflict_editor.png
deleted file mode 100644
index f10efbce5f5..00000000000
--- a/doc/user/project/merge_requests/img/merge_conflict_editor.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/merge_requests/img/merge_conflict_editor_v16_7.png b/doc/user/project/merge_requests/img/merge_conflict_editor_v16_7.png
new file mode 100644
index 00000000000..b56ee2abdd7
--- /dev/null
+++ b/doc/user/project/merge_requests/img/merge_conflict_editor_v16_7.png
Binary files differ
diff --git a/doc/user/project/merge_requests/img/merge_request_widget.png b/doc/user/project/merge_requests/img/merge_request_widget.png
deleted file mode 100644
index 58562fcb034..00000000000
--- a/doc/user/project/merge_requests/img/merge_request_widget.png
+++ /dev/null
Binary files differ