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!
-
Click the
Gitea
top tab. -
In Gitea's own UI, the
Explore
upper tab andCode
lower tab should have focus. -
Click the Branch selector drop-down at left, and select
dev
. -
Click the next button over,
New Pull Request
. -
On the
New Pull Request
page, change themerge into
selector to readgituser:prod
.The Gitea page should look something like this:
-
Click the
New Pull Request
button. -
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
.) -
You can also modify the title field's default entry (which is just
dev
) to make it more descriptive. -
Click the
Create Pull Request
button at the bottom.
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:
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.
Once you're done browsing around:
- Still in the
Gitea
UI, click back to theConversations
tab. - Scroll down and click the green
Merge Pull Request
button. - 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.
- Finally, just click the
Merge Pull Request
button again, and the PR will be merged.
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.