LinuxCommandLibrary

git-mr

Create merge requests from the command line

TLDR

Check out a specific merge request

$ git mr [mr_number]
copy

Check out a merge request from a specific remote
$ git mr [mr_number] [remote]
copy

Checkout a merge request from its URL
$ git mr [url]
copy

Clean up old merge request branches
$ git mr clean
copy

SYNOPSIS

git mr [options]

PARAMETERS

--browse
    Opens the new merge request page in the default web browser after creating the branch. This behavior might be enabled by default in some implementations.

--target
    Specifies the target branch for the merge request. Overrides any default or upstream-configured branch.

--create
    Forces the creation of a new merge request, even if one already exists for the current branch.

--view
    Opens existing merge requests for the current branch. Depending on implementation may allow to view existing MRs.


    Opens a specific merge request by its ID or number. Not all implementations may support this.

DESCRIPTION

The `git mr` command is a utility designed to simplify the process of creating and opening merge requests (also known as pull requests) on platforms like GitLab and GitHub directly from the command line. It automates the steps involved in identifying the appropriate remote repository, determining the target branch, and constructing the correct URL to open the merge request creation page in your web browser. This command saves time and effort compared to manually navigating to the repository through the web interface.

It typically integrates with Git configuration to determine the remote repository and branch information. The command usually infers the target branch based on the current branch's upstream setting. If no upstream is configured, a default branch (e.g., `main` or `master`) is often used. The command also may provide options to specify the target branch explicitly, or to choose between creating a new merge request, viewing existing merge requests for a branch, or to view a specific merge request by its ID. The specific features and options available vary depending on the tool or script implementing the `git mr` command.

CAVEATS

The availability and specific options of `git mr` command depends entirely on the external script/tool used. Not a standard git command.

CONFIGURATION

Often, the `git mr` command relies on Git configuration to determine the remote repository URL. Setting up your Git remote correctly is crucial for the command to work as expected. Check your `.git/config` file to ensure your remote repository URL is configured properly.

INSTALLATION

Because `git mr` is not a standard Git command, you'll need to install a tool that provides it. Check the documentation for your chosen Git platform (e.g., GitLab, GitHub) for specific installation instructions. It may involve installing a command-line tool like `gitlab-cli`.

HISTORY

The `git mr` command is not a built-in Git command. It is typically provided by third-party tools or scripts that extend Git's functionality. Tools like `gitlab-cli` or custom scripts may provide this functionality. Its purpose is to simplify interactions with online Git repositories (like GitLab and GitHub) by automating common tasks related to merge requests. Its development arose from the need to streamline the merge request workflow and reduce the manual steps involved.

SEE ALSO

git push(1), git branch(1), git remote(1)

Copied to clipboard