Skip to main content
The ConflictsService provides methods for listing conflict files and resolving conflicts during merge operations.

ListConflictFiles

Lists all files with conflicts between two commits.

Request

repository
Repository
required
The repository to check for conflicts
our_commit_oid
string
required
The OID of the local commit
their_commit_oid
string
required
The OID of the remote commit to merge
allow_tree_conflicts
bool
If true, the request will not fail when tree conflicts are present. Responses may contain conflict files where some paths are unset.

Response (Stream)

files
ConflictFile[]
Array of conflict files

ConflictFile

Each ConflictFile contains either a header or content:
header
ConflictFileHeader
Metadata about the conflicting file
content
bytes
Chunk of file content with conflict markers

ConflictFileHeader

commit_oid
string
Commit OID where the conflict was detected
their_path
bytes
Path in their branch
our_path
bytes
Path in our branch
our_mode
int32
File mode in our branch
ancestor_path
bytes
Path in the common ancestor

ResolveConflicts

Attempts to resolve conflicts with user-provided merge resolutions. If successful, creates a new merge commit.

Request (Stream)

The first message must contain the header, followed by messages containing the files JSON data.

Header (First Message)

repository
Repository
required
The repository where conflicts will be resolved and where source_branch will be updated
our_commit_oid
string
required
The OID of the local commit
target_repository
Repository
required
The repository from which their_commit_oid will be retrieved
their_commit_oid
string
required
The OID of the remote commit to merge into the local commit
source_branch
bytes
required
The branch on which the new merge commit will be created
target_branch
bytes
required
The branch to fetch from target_repository if their_commit_oid doesn’t exist in repository
commit_message
bytes
required
The commit message for the newly created merge commit
user
User
required
The user to set as author and committer of the merge commit
timestamp
google.protobuf.Timestamp
Optional timestamp to use as the committer date. If not set, the current time is used.

Subsequent Messages

files_json
bytes
JSON-encoded list of conflict resolutions

Response

resolution_error
string
Description of why conflict resolution failed. Empty if successful. Check this field to verify whether the merge commit was correctly created.

Build docs developers (and LLMs) love