Week 5 session 1: Github walkthrough; modules and testing
Recording
Schedule and plan
Github walkthrough
Diagram of the workflow:
Team leader:
- Before you start, agree a team name with your team, and get your team members’ Github usernames — e.g.
matthew-brett. - Go to https://github.com/nipraxis/diagnostics-template
- Open the Issues tab. You can get there directly by appending
issuesto the URL, like this: https://github.com/nipraxis/diagnostics-template/issues - Make a “New Issue”.
- In the issue, ask for a new diagnostics repository for your team. Specify a name for your team.
- Wait for our response, on that issue.
- You will see URL to your new repository named
nipraxis-summer-2023/diagnostics-<teamname>where<teamname>is the name you specified in your issue. You may also get an email telling you about the repository. - Go to the link for your repository. It will be of form
https://github.com/nipraxis-summer-2023/diagnostics-<teamname>. - Make sure you know the Github usernames of your team members.
- Go to the Settings tab.
- Click on “Collaborators and Teams” on the left.
- Click on “Add people”. Add the team members with whatever permissions you agree. Maybe “maintain” is a good default.
- Wait for your team members to accept their invitations.
Everyone (including the team leader):
- You should get an invitation to your team repository.
- Click on the link, that should be of form
https://github.com/nipraxis-summer-2023/diagnostics-<teamname>, where<teamname>is your agreed team name. - Click on the “Fork” button near the top right of the screen.
- Accept the defaults, click “Create Fork”.
- Now you should be at a new page, with URL of form:
https://github.com/<your-gh-user>/diagnostics-<teamname>where<your-gh-user>is your Github username. - Click on the green “Code” button, select the “HTTPS” tab. Copy the link there, which will be of form:
https://github.com/<your-gh-user>/diagnostics-<teamname>. If you have got SSH keys set up, you might instead consider using the “SSH” tab, and link. - Open a terminal on your computer. Change to a suitable directory to store your code. Consider
cd $HOME/Documents/nipraxis-workif you don’t have a strong alternative preference. - Type a suitably modified version of this command:
git clone https://github.com/<your-gh-user>/diagnostics-<teamname>, replacing the relevant parts with your username and your team name. (If you used SSH above, modify the clone command to something of formgit clone git@github.com:<your-gh-user>/diagnostics-<teamname> - You should now have a local clone of your fork.
- Change directory to the new cloned repository, with command of form
cd diagnostics-<teamname>. - Add a new remote that points to the main “upstream” version of your team code, using a command of form:
git remote add upstream https://github.com/nipraxis-summer-2023/diagnostics-<teamname>. - Check your remote worked with the command
git fetch upstream. - Make a new feature branch
editing-readme, with the commandgit branch editing-readme. - Checkout this branch with
git checkout editing-readme. - Make sure you are up to date with the latest code from upstream with
git merge upstream/main. This may do nothing, if there are no new changes in the upstreammainbranch. - Use your text editor to make a change to the
README.mdfile. - Confirm Git agrees that you have changed the file with
git status - Add the file to the staging area with
git add README.md - Confirm Git agrees that you have added the file with
git status git commit(if you have your text editor set up correctly to work with Git) orgit commit -m 'Edit to README'(if you do not).- Push up your changes to your fork with
git push origin editing-readme --set-upstream. - Next make a pull request from this branch on Github. Either use the URL that Github displays in your terminal from the command above, of form
https://github.com/<your-gh-user>/diagnostics-<teamname}/pull/new/editing-readme, OR go to your fork URL (ofhttps://github.com/<your-gh-user>/diagnostics-<teamname>, and use the new green “Compare and pull request” button for yourediting-readmebranch. Click on that - Fill in the pull request description and submit the pull request.
The team leader should:
- Go to the main repository page — of form
https://github.com/nipraxis-summer-2023/diagnostics-<teamname>. - Click on one or more of the Pull Request pages available there, and click on the green Merge button to merge it / them. (In fact, there are several options available via that green button, we are taking the default route by clicking on the green button. See the Github merge page for more details.
Techniques
- @ mentions on Github.
Modules and testing
Reading and homework for next week
You should (by Thursday) receive a pull request into your upstream repository. Please check there for the homework.
If you do not see a pull request, please email Matthew.
The pull request has instructions, and some more pages to read.
Your task:
- Merge the pull request.
- Go to your local clone of your fork.
git fetch upstreamgit branch fix-validation upstream/maingit checkout fix-validation
For instructions, first, look in the Get the data section of the README.md file, and follow the instructions there.
Then look at the files:
scripts/validate_data.py
Next work on the code to run the given commands and fix the errors. See the instructions in the PR.
Now push, and make a pull request. Work together to find the best solution, review the pull request, and merge it.