🔃 Comparing changes
As developers, we often develop new features on a branch.
When we’ve completed the feature, we need to merge our changes into another branch.
So we’ll need a way to compare changes between two different branches on GitHub.
Let’s consider the following situation.
We have a repository like this:
And there’s another forked repository belonging to owner Dedekind561.
Dedekind561 has created a branch called
bio-page with the new feature.
🍴 Forked repository
🎯 Goal: Merge changes from the
bio-pagebranch into the CodeYourFuture/GitHomeworkTest
To merge changes from one branch to another, we need to let other users know:
- what the changes are
- which branches we’re comparing
- additional context about the proposed change, like why we’re making the change
For this purpose, we can use a pull request.
definition: Pull Request
Creating a new pull request
During the course, we’ll use pull requests to review your work. You’ll need to push your work on a branch and then open a pull request to get feedback on your work.
We can use the Github interface to create a new pull request.
The steps below assume you have a forked a repository called
GitHomeworkTest and you’ve pushed a branch to this remote repository.
Go to your forked repository. The page should look like this:
Double check your url, it should be
Locate the branches button on this page.
📝 Double check you’re on a branches view like this.
Locate the New pull request button for the
Double check you can see the Open a pull request view.
a) Double check the base repository ( it should be set to
b) Double check the head repository ( this should be the forked repository
c) Double check the base branch ( this should be set to
d) Double check the head branch ( this should be set to
Update the pull request title to include your region, name and the week the coursework is for.
Update the pull request description with information about the changes on your branch.
Below we’ve added a description “Create a bio page with details about myself”
Finally, click on Create pull request.
Double check you end up with a pull request like this:
a) Locate the Files changed tab and check the change you’ve added in your branch
b) Locate the Commits tab and check the commits from your
Using a pull request template
Some repositories are set up with a template for a description, which gets automatically set in the Open a pull request view.
Check the description field for any instructions to complete the pull request.
Check out the example below:
Here there are some prompts for you to fill in information - make sure you fill it in.