Sciware
Intro to GitHub
https://sciware.flatironinstitute.org/21_IntroGithub
https://github.com/flatironinstitute/learn-sciware-dev/tree/master/21_IntroGithub
Rules of Engagement
Goal:
Activities where participants all actively work to foster an environment which encourages participation across experience levels, coding language fluency, technology choices*, and scientific disciplines.
*though sometimes we try to expand your options
Rules of Engagement
- Avoid discussions between a few people on a narrow topic
- Provide time for people who haven’t spoken to speak/ask questions
- Provide time for experts to share wisdom and discuss
- Work together to make discussions accessible to novices
(These will always be a work in progress and will be updated, clarified, or expanded as needed.)
Zoom Specific
- Dedicated Zoom moderator to field questions.
- Please stay muted if not speaking. (Host may mute you.)
- We are recording. Link will be posted on #sciware Slack.
Future Sessions
- June 29: Showcase of code editors, development environments (show & tell)
- July 21 (preliminary): Shells, environments, command-lines
Today’s Agenda
Collaborating on GitHub
- Forking
- Pull Requests
- Reviewing
Step 0: A clean start
- If you already have a copy of this repo from yesterday's workshop, navigate to the directory above it and rename it.
- Normally you'd re-use this repository, but just to make sure everyone's on the same page...
> mv sciware21-git-intro/ sciware21-git-intro-day1/
Collaborating with others
- We need something more than a single repo, if we want to…
- make changes separately from a main project
- take an existing project in a new direction
- make and track changes to repositories we don’t have permissions to push to
Forking to the Rescue
<img width=80% src=”./assets/Learn-Git-Graphics/Forking%20a%20Repo.png”>
Forking Workflow
- Fork and clone the project
- Add the code and push to your fork
- Merge code into the main project
- Keep your fork up to date
Step 1: Fork and Clone
<img width=80% src=”./assets/Learn-Git-Graphics/Clone%20the%20Fork.png”>
Step 1: Fork and Clone
First we need to fork the repo
https://github.com/flatironinstitute/sciware21-git-intro
Next, we clone
our fork of the repo:
➜ git clone git@github.com:your_user_name/sciware21-git-intro.git
Step 2a: Add Your Code
- Add a file in
student_info
called firstName_lastName.csv
with the following info:
- Your full name
- Your center
- Your research focus
- A fun fact
Step 2a: Add Your Code
For example:
Name,Center,Research Focus,Fun Fact
James Smith,CCQ,Quantum Chemistry,My initials are JETS
Step 2b: Push to Your Fork
<img width=80% src=”./assets/Learn-Git-Graphics/Push%20to%20the%20Fork.png”>
Step 2b: Push to Your Fork
- Run
git add
on your file
- Commit it
- Push to your fork
For example:
➜ git status
...
➜ git add student_info/james_smith.csv
➜ git commit -m "Adding info for James Smith"
...
➜ git push origin main
Step 3: Open a Pull Request
<img width=80% src=”./assets/Learn-Git-Graphics/Open%20a%20Pull%20Request%20for%20the%20Fork.png”>
Step 3: Open a Pull Request
- Using your browser, navigate to your forked repository
- It should look something like this:
- Click on the
Contribute
button
Step 3: Open a Pull Request
- Click on the
Open pull request
button
Step 3: Open a Pull Request
Step 3: Open a Pull Request
Things to think about when making pull requests (PR):
- Many projects have PR templates with information you need to fill out, use them!
- Include why you're making the PR, what steps you took, and how it addresses a current problem.
- Bug reports should always include a minimum working example.
- PRs (and Issues) are a valuable public record, just like StackOverflow.
Reviewing a Pull Request
As other students make PRs, go to the pull requests tab on GitHub.
Reviewing a Pull Request
Choose another student’s PR and click on it.
Click on the commit to see the diff of their changes and hover over a line until you see the +
sybmol.
PR Case Study
Here’s an example of a PR without a helpful description:
PR Case Study
Here’s an example of a PR with a helpful description:
<img height=70% width=60% src=”./assets/pr_case_study_good.png”>
Survey
http://bit.ly/sciware-github2-2022
Step 4: Pull Other’s Changes
<img width=80% src=”./assets/fetch-upstream-3.png”>
Step 4: Pull Other’s Changes
<img width=80% src=”./assets/fetch-upstream-1.png”>
➜ git pull origin main
Check out and bookmark these tutorials for more information about git and the forking workflow:
Survey
http://bit.ly/sciware-github2-2022