sciware

Sciware

Intro to GitHub

https://sciware.flatironinstitute.org/27_SummerIntro

Sciware 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

Sciware website

Previous sciwares available here https://sciware.flatironinstitute.org

Password for videos is…

Sciware slack, contact

#sciware on simonsfoundation.slack.com (use flatiron email)

Computational help: scicomp@flatironinstitute.org

Summer Intros

Today’s Agenda

Collaborating on GitHub

Collaborating with others

Forking Workflow

  1. Fork the repository on github
  2. Clone your new fork from github to local
  3. Make changes to the code
  4. Push to your fork
  5. Open a Pull Request (PR) from your fork to the upstream repo
  6. Wait for upstream to approve and merge your changes
  7. Keep your fork up to date

Step 0: A clean start


> mv sciware27-git-intro/ sciware27-git-intro-day1/
</pre>


## Step 1: Fork

<img width=80% src="./assets/Learn-Git-Graphics/Forking%20a%20Repo.png">


## Step 1: Fork

First we need to fork the repo
https://github.com/flatironinstitute/sciware27-git-intro



## Step 2: Clone

<img width=80% src="./assets/Learn-Git-Graphics/Clone%20the%20Fork.png">


## Step 2: Clone

Next, we clone our fork of the repo:


> git clone git@github.com:your_user_name/sciware27-git-intro.git
## Step 3: Add Your Code - Add a file in the `student_info/` directory called `firstName_lastName.csv` with the following info: - Your full name - Your center - Your research focus - A fun fact

> cd student_info/
> nano
## Step 3: Add Your Code Example contents of `robert_blackwell.csv`:
    
Name,Center,Research Focus,Fun Fact
Robert Blackwell,SCC,high performance computing,violin!
    
Save the file. ## Step 4: Push to Your Fork <img width=80% src="./assets/Learn-Git-Graphics/Push%20to%20the%20Fork.png"> ## Step 4: Push to Your Fork - Add the file - Commit the file - Push the commit to your fork

       > git status

> git add student_info/robert_blackwell.csv
> git commit -m "Adding info for Robert Blacwell"

   > git push origin main
# Break Please take survey if you're leaving now ## http://bit.ly/sciware-github2-2023 ## Step 5: Open a Pull Request <img width=80% src="./assets/Learn-Git-Graphics/Open%20a%20Pull%20Request%20for%20the%20Fork.png"> ## Step 5: Open a Pull Request - Using your browser, navigate to your forked repository - It should look something like this: - Click on the `Contribute` button ## Step 5: Open a Pull Request - Click on the `Open pull request` button ## PR Case Study Here's an example of a PR _without_ a helpful description: ![](/27_SummerIntro/assets/pr_case_study_bad.png) ## PR Case Study Here's an example of a [PR](https://github.com/scikit-learn/scikit-learn/pull/20251) _with_ a helpful description: <img height=70% width=60% src="./assets/pr_case_study_good.png"> ## Step 5: Open a Pull Request Things to think about when making pull requests (PR):
  • PRs are a way for someone else to review your changes before they are merged into the "upstream" version.
  • PRs usually contain many commits.
  • The first comment in the PR should be more narrative than the commit messages and should describe why you're making the PR and summarize the changes you made.
  • PRs are a valuable record, similar to a lab notebook.
## Step 5: Open a Pull Request Finish up your pull request and click "Create Pull Request" ## Step 6: Wait for your PR to be merged Someone else will merge your PR. In practice, someone might leave comments on your PR and/or request changes before merging. ## Step 7: Pull Other's Changes <img width=80% src="./assets/fetch-upstream-3.png"> ## Step 7: Pull Other's Changes to your Fork Sync. <img width=80% src="./assets/fetch-upstream-1.png"> ## Step 7: Pull Other's Changes to your Fork (Sync) Sync. <img width=80% src="./assets/fetch-upstream-4.png"> ## Step 8: Pull Other's Changes to your Local

    > git pull origin main
## Step 8: Pull Other's Changes to your Local Confirm that you have the changes locally.

      > git log
      > ls student_info/
    
## Extra Resources Check out and bookmark these tutorials for more information about git and the forking workflow: - [Bitbucket: Making a Pull Request](https://www.atlassian.com/git/tutorials/making-a-pull-request) - [CodeRefinery: Distributed version control and forking workflow](https://coderefinery.github.io/git-collaborative/03-distributed/) # Survey ## http://bit.ly/sciware-github2-2023