-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from dfe-analytical-services/newfeature/pull-r…
…equests Newfeature/pull requests
- Loading branch information
Showing
16 changed files
with
216 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
--- | ||
title: "Making more branches" | ||
--- | ||
|
||
This section will guide you through how to create more branches, taking the main branch you created as a base. | ||
|
||
When you create a Git project, it will automatically create a "main" (sometimes "master") branch for you. This is where the code that has been QA'd and you are happy with should sit. | ||
|
||
It is good practice to create a branch whenever you have a change to make to your work. Having two branches means that if anything goes wrong in the "development branch", the "main" branch is still unaffected and runs without issue. This lets you test and QA the code more thoroughly before merging into your main branch. | ||
|
||
::: {.callout-note} | ||
Chose one method below to create your new branch, which we will call "development". Then follow the instructions at the bottom of this page to update your logbook. | ||
::: | ||
|
||
::: panel-tabset | ||
## Git Bash | ||
|
||
1. Ensure you're on your own personal main branch that you created in [making a branch](#making-a-branch). If you aren't sure use: | ||
|
||
``` bash | ||
git checkout -b <github_username>/main | ||
``` | ||
|
||
2. Pull the latest changes from the remote repository. | ||
|
||
``` bash | ||
git pull origin <github_username>/main | ||
``` | ||
|
||
3. Create your new development branch | ||
|
||
``` bash | ||
git checkout -b <github_username>/development | ||
``` | ||
|
||
4. Push the new branch to the remote repository: | ||
|
||
``` bash | ||
git push -u origin <github_username>/development | ||
``` | ||
|
||
5. Check that the new branch shows in the branch list. | ||
|
||
``` bash | ||
git branch | ||
``` | ||
|
||
 | ||
|
||
## RStudio | ||
|
||
1. Ensure you are on your personal main branch. | ||
|
||
2. In the Git panel, click the purple new branch symbol  as to the left of the username in the screenshot below. | ||
|
||
3. Then enter your development branch name as **`<github_username>/development`** (but replacing <github_id> with your own GitHub username, e.g. `jsmith_development`) | ||
|
||
 | ||
|
||
## GitHub Desktop | ||
|
||
1. Click **Branch** in the menu bar and then select **New branch...** as shown in the screenshot below. | ||
|
||
2. Then enter your branch name as **`<github_username>/development`** (but replacing <github_id> with your own GitHub username, e.g. `jsmith_main`) | ||
|
||
 | ||
|
||
## VS Code | ||
|
||
1. The current branch **`(<github_username>main)`** should be listed in the very bottom left hand corner of the VS Code window frame. If you left click on this, you should then see a menu appear at the top of the VS Code window with some branch options (as shown in the screen shot below). | ||
|
||
2. Click **+ Create new branch...** and then enter your branch name as **`<github_username>/development`** (but replacing <github_id> with your own GitHub username, e.g. `jsmith_development`). | ||
|
||
3. You should now see the branch name listed in the bottom left of the window frame shown as the branch you just created, meaning any changes you currently make will be applied to that new development branch (and not the main branch, or your personal main branch). | ||
|
||
|
||
## PyCharm | ||
|
||
1. Open up the Git panel in PyCharm and you should see something like the screenshot below. Right click on your **`<github_username>/main`** branch and select **New branch from '\<github_id\>/main'...**. | ||
|
||
2. Then enter your branch name as **`<github_username>/development`** (but replacing <github_id> with your own GitHub username, e.g. `jsmith_development`). | ||
|
||
 | ||
|
||
::: | ||
|
||
::: callout-tip | ||
## Edit your git-academy-log file | ||
Now you have made your development branch, go to your git log and update tick the 'making a development branch' box. Use the [recording changes](recording-changes) section for a reminder on how to make and save changes. Ensure to commit and push your changes. | ||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
--- | ||
title: "Creating pull requests" | ||
--- | ||
|
||
::: callout-information | ||
You will need two branches to merge to be able to create a pull request. If you haven't already, follow the steps in [making a branch](../git-refresher/making-a-branch.qmd), [recording changes](../git-refresher/recording-changes.qmd) and [create more branches](../git-refresher/making-more-branches.qmd) to be able to create and complete a mock pull request | ||
::: | ||
|
||
A [pull request](../glossary.html#pull_request) allows you to notify your team about changes you've committed and pushed to a branch in a repository on GitHub. Once a pull request is opened, you can discuss and review the potential changes with collaborators and add any necessary follow-up commits before the changes are merged into the main branch. | ||
|
||
Now you have made changes in your [development branch](making-a-development-branch), we will practice this by merging the changes into your main branch using a pull request. | ||
|
||
## Creating pull requests | ||
|
||
Once you have made all the changes you want to include in this batch of work, you'll bundle all of your commits together into a pull request for review. | ||
|
||
::: {.callout-note} | ||
Before attempting to create your pull request, make sure to have pushed any changes on the branches involved to the remote repo on GitHub | ||
::: | ||
|
||
::: panel-tabset | ||
## Git Bash | ||
|
||
Create your pull request, adding a title and a description of your changes | ||
|
||
``` bash | ||
gh pr create --base <github_id>/main --head <github_id>/development --title "Update to log book" --body "Updating logbook to reflect completing the development branch task." | ||
``` | ||
|
||
## GitHub Website | ||
|
||
1. Go to the [git-academy-sandbox](https://github.com/dfe-analytical-services/git-academy-sandbox) repository page on GitHub. | ||
|
||
2. Navigate to the Pull requests tab underneath the repository title. | ||
{fig-alt="Higlighting the Pull requests tab on GitHub."} | ||
|
||
3. Open a pull request by clicking the "New pull request" button. | ||
|
||
4. Ensure the base branch is set to your own main branch (<github_username>/main) and the compare branch is set to your development branch (<github_username>/development). | ||
|
||
{fig-alt="Higlighting where to change the base and compare branches once you have pressed the 'create a pull request' button on GitHub."} | ||
|
||
|
||
5. Create Pull Request: Click the "Create pull request" button. Add a title and description for your pull request. You may wish to explain what changes and been made, and why. | ||
|
||
6. You don't need to add any reviewers in this training, but please do take a moment to notice where you can add team mates to review your pull requests in your own work to the right of the description. Any reviewers you add will be notified by email that there is a pull request for them to review. | ||
|
||
7. Once you are happy with your title and description, click 'Create pull request' to confirm. | ||
|
||
8. You will then want to check whether there are any merge conflicts. If there are merge conflicts, they will need resolving before you are able to complete your pull request. | ||
|
||
## GitHub Desktop | ||
|
||
1. Ensure you are on the development branch. | ||
|
||
2. Click on the 'Branch' menu and 'Create pull request' | ||
|
||
3. Click 'open in browser'. This will open GitHub in your web browser with the pull request form pre-filled. | ||
|
||
4. Add a title and description for you pull request and then click 'Create pull request' | ||
|
||
## VS Code | ||
|
||
## PyCharm | ||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
title: "Reviewing pull requests" | ||
format: html | ||
--- | ||
|
||
When a pull request is created, it's important to review the changes carefully. This process helps ensure that the code meets the project's standards and doesn't introduce any new issues. During the review, you can discuss the changes with the author, suggest improvements, and request additional commits if necessary. | ||
|
||
We will practice this by reviewing the pull request you have just made in [creating pull requests](pull-requests.qmd). | ||
|
||
### GitHub Website | ||
|
||
1. Go back to the [git-academy-sandbox](https://github.com/dfe-analytical-services/git-academy-sandbox) repository overview page on GitHub, as if you have just come to find the pull request your colleague has asked you to review. | ||
|
||
2. Navigate to the 'Pull requests' tab. | ||
|
||
3. Click on the pull request you want to review, in this case the one you created above. | ||
|
||
{fig-alt="Higlighting where open pull requests show in GitHub once the Pull request tab has been opened."} | ||
|
||
4. Review the changes by looking at the "Files changed" tab. You can see a side-by-side comparison of the changes made. Add comments by clicking the "+" icon next to the lines of code you want to comment on. | ||
|
||
{fig-alt="Higlighting where to view comparison of changes made and make comments on a pull request."} | ||
|
||
5. When reviewing pull requests, you may also wish to view changes locally to check the code runs and view any outputs.You can do this by pulling and changing to the branch that is being requested to be merged in. | ||
|
||
6. Once you have reviewed the changes, you can leave general feedback, approve or request changes by clicking the 'review changes' button. | ||
|
||
{fig-alt="Higlighting where to provide general feedback, request changes or approve on a pull request."} | ||
|
||
7. Once you are happy with the changes, you should approve the pull request. The person who created the request will then get an email letting them know their changes have been approved. It can also be helpful to send them a direct message to let them know you have reviewed their PR! They can then go back and complete the request. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
title: "Pre-requisities" | ||
title: "Prerequisites" | ||
--- | ||
|
||
## Git | ||
|