Contributing¶
Introduction¶
We follow the same design as PlasmaPy for contributing. Please see the PlasmaPy contributing workflow guide for more information.
This page describes the workflow for making a contribution to WiPPLPy via a pull request. This page assumes that you have finished the steps for Installation.
Making a code contribution¶
Create a new branch¶
Navigate to the
WiPPLPy/directory that contains the clone of your repository.In the terminal, run:
git statusIf the output ends with
nothing to commit, working tree clean, then proceed to the next step.Tip
What to do with uncommitted changes?
If
git statusshows that any files are listed underChanges not staged for commitorChanges to be committed, then do one of the following before proceeding to the next step:Use git stash to temporarily file away the changes, or
Use
git reset --hardto permanently remove all changes to tracked files and return to the previous commit.
If there are untracked files present, then you may delete the untracked files, add and commit changes, or proceed to the next step.
Download the current status of WiPPLPy’s GitHub repository and your fork by running:
git fetch --all
Create and switch to a new branch by running:
git checkout -b new-branch-name upstream/main
where
new-branch-nameis changed to the name of the new branch. Hereupstreamis the name of the remote andmainis the name of the original branch.Tip
Use descriptive branch names like
update-contribution-workflow.Connect your local branch to your fork of WiPPLPy on GitHub by running:
git push --set-upstream origin new-branch-name
If you previously ran
git stashand want to apply those changes to the new branch, rungit stash popto restore the changes onto the new branch.
Add and commit changes¶
Next we can go through the cycle of making changes, which can be repeated multiple times.
Edit a file and save the changes.
In a terminal, run:
git add filename
where
filenameis replaced with the name of the edited file(s). Usegit add *to add all files in the directory (except for files specified in.gitignore). This step lets us line up the changes that we want to record as a snapshot in history.To commit the changes, run:
git commit -m "<commit message>"
where
<commit message>is replaced with a descriptive commit message such as"Add gyroradius function". Committing a change is like preserving a snapshot of what each file looks like at this point in history.If it has been installed, pre-commit will perform automated checks and possibly make some automated changes. If pre-commit fails, then it’ll be necessary to do the
git addandgit commitsteps once more.To push the changes to GitHub, run:
git push
Tip
Try using the git status command after each step to get a
better idea of what is happening.
Note
The git workflow can be thought of as the process of mailing a
package.
git addis like packing the contents of a package into a box. This step allows you to choose which changes to include in the next commit.git commitis like sealing and labeling the package, and putting it in the outgoing mail.git pushis like sending the package off to its destination (i.e., GitHub).
Creating a pull request¶
Run
git pushto make sure that branch on GitHub is up-to-date.Go to WiPPLPy’s GitHub repository.
If you recently pushed new changes, a pale yellow box will appear near the top of the screen. In that box, click Compare & pull request.
Note
If you did not recently push any new changes, click on New pull request and then the link saying “compare across forks.” Select
WiPPLPy/WiPPLPyfor “base repository” andmainfor “base”. Choose your fork of PlasmaPy for “head repository” and the name of the branch for “compare”. Then click on Create pull request.Add a descriptive title, such as
Add a function to calculate particle gyroradii.Write a description for the pull request (PR). Describe the changes, and why they are being made. Include information that you think would be helpful for reviewers, future users, and future contributors..
Tip
If your pull request will resolve an issue, include
Closes #ISSUE-NUMBERin the pull request description, whereISSUE-NUMBERis replaced with the number of the issue.Select Create pull request.
Tip
If the pull request isn’t ready for review, select the ▼ next to Create pull request to enable you to create a draft pull request instead.
Note
After the pull request has been created, it can be updated by using
git pushto update the corresponding branch on GitHub.
At this stage, a reviewer will perform a code review, unless it has been marked as a draft pull request. Thank you for contributing!