Skip to main content

Creating and Merging a Pull Request

Now it's time to create and then merge a pull request (PR) to get our changes to the production instance. The Web UI process for creating and merging PRs is a little bit different for each Git server implementation. But they are close enough that you should be able to easily generalize the steps below to your own system.

Let's create our PR!

Creating the Pull Request
  1. Click the Gitea top tab.

  2. In Gitea's own UI, the Explore upper tab and Code lower tab should have focus.

  3. Click the Branch selector drop-down at left, and select dev.

  4. Click the next button over, New Pull Request.

  5. On the New Pull Request page, change the merge into selector to read gituser:prod.

    The Gitea page should look something like this: New Pull Request

  6. Click the New Pull Request button.

  7. On the lower Write text box, type a message to explain the changes in this PR. (E.g., Merge full config from dev to prod.)

  8. You can also modify the title field's default entry (which is just dev) to make it more descriptive.

  9. Click the Create Pull Request button at the bottom.

Best Practice - PR Titles and Descriptions

Commits and pull requests jointly provide your, and your collaborators', view into the activity in your Git repository. As such, it's important to give them descriptive titles and clear descriptions.

You should now see something like this: Ready to Merge PR

Best Practice - Git Checks and Separation of Duties

Among the big benefits of Git as a versioning control system are its workflow capabilities, and how they can facilitate peer reviews, etc. In a production environment, you'd want to add at least one reviewer to your PR. You'd also want to make sure that the PR can't be merged until it's reviewed (even by multiple reviewers, if you so choose). It's also a good practice to have someone other than the submitter merge the request – though reviews can be seen as a proxy for that second-party confirmation.

For the purpose of our sandbox, we're going to go ahead and do exactly what we told you not to do above! That is, you'll merge your own PR. Merging a PR is easy, but before we do it, click around the PR to see what info the approver/merger has available to them:

  • The Commits tab - shows the different discrete Git commits included in the PR. You should recognize all the commit messages you entered back in Stream's UI.
  • The Files Changed tab - shows a diff view of each file changed in the PR.
Merging the PR

Once you're done browsing around:

  1. Still in the Gitea UI, click back to the Conversations tab.
  2. Scroll down and click the green Merge Pull Request button.
  3. New fields will pop up, prompting for a fresh title and description. If you were this PR's reviewer, these are good places to note anything especially relevant from your review, etc.
  4. Finally, just click the Merge Pull Request button again, and the PR will be merged.
Conflicts

Managing and resolving merge conflicts on a PR is beyond the scope of this sandbox. But should you run into these kinds of problems, check your Git service provider's documentation for the best methods to resolve them. Although a standard set of CLI commands is available for this, some providers offer a visual UI that simplifies the process for you.