Commit 2c97a540 authored by Russell Dickenson's avatar Russell Dickenson

Merge branch 'docs-mwps-crosslink-push-examples' into 'master'

Improve Merge when pipeline succeeds docs

Closes #34298

See merge request gitlab-org/gitlab!18776
parents 374e2e4b 98605362
...@@ -85,3 +85,8 @@ questions that you know someone might ask. ...@@ -85,3 +85,8 @@ questions that you know someone might ask.
Each scenario can be a third-level heading, e.g. `### Getting error message X`. Each scenario can be a third-level heading, e.g. `### Getting error message X`.
If you have none to add when creating a doc, leave this section in place 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. --> but commented out to help encourage others to add to it in the future. -->
## Use it from the command line
You can use [Push Options](../push_options.md) to trigger this feature when
pushing.
...@@ -75,3 +75,33 @@ merge request, and target a branch named `my-target-branch`: ...@@ -75,3 +75,33 @@ merge request, and target a branch named `my-target-branch`:
```shell ```shell
git push -o merge_request.create -o merge_request.target=my-target-branch git push -o merge_request.create -o merge_request.target=my-target-branch
``` ```
Additionally if you want the merge request to merge as soon as the pipeline succeeds you can do:
```shell
git push -o merge_request.create -o merge_request.target=my-target-branch -o merge_request.merge_when_pipeline_succeeds
```
## Useful Git aliases
As shown above, Git push options can cause Git commands to grow very long. If
you use the same push options frequently, it's useful to create [Git
aliases](https://git-scm.com/book/en/v2/Git-Basics-Git-Aliases). Git aliases
are command line shortcuts for Git which can significantly simplify the use of
long Git commands.
### Merge when pipeline succeeds alias
To set up a Git alias for the [merge when pipeline succeeds Git push
option](#push-options-for-merge-requests):
```shell
git config --global alias.mwps "push -o merge_request.create -o merge_request.target=master -o merge_request.merge_when_pipeline_succeeds"
```
Then to quickly push a local branch that will target master and merge when the
pipeline succeeds:
```shell
git mwps origin <local-branch-name>
```
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment