We use the Gitflow workflow to make our lives easier.
This means all edits should be made in separate branches -- not the master
branch.
Only the project maintainer will make edits or merge on master
.
View the open issues to see the To-Do list. If an issue isn't assigned to anyone, we would welcome your contribution!
If you need a refresher on Git or GitHub, see:
- Software Carpentry's lesson: Version Control with Git
- Hadley Wickham's chapter on Git and GitHub in his book R Packages
-
Either
clone
orfork
this repo.-
clone if you have write access:
git clone https://github.com/SchlossLab/ML_pipeline_microbiome
(All Schlabbies have write access.)
-
fork if you do not have write access by pressing the Fork button on GitHub, then clone your fork.
-
-
Move to the repo directory.
cd ML_pipeline_microbiome
-
Create a new branch for your feature.
Give it a short, descriptive name.
git checkout -b feature-branch-name
The branch name should reflect the bug or feature it will resolve, or reference the issue number directly (examples). [Note: wherever you see
feature-branch-name
in these instructions, replace that with your branch's actual name.] -
Make your edits.
-
Add & commit changes.
git add filename.R git commit -m "Implement cool feature XX (Resolves #Y)"
Use this style guide for writing good commit messages. The highlights:
- Capitalize the first word of the message.
- The first word should be a verb in the imperative tense.
- Keep the message short but descriptive of the changes.
In the merge commit message, reference any issues (our To-Do list) that the pull request resolves so the issue is closed automatically. For example, the commit message I wrote when adding this file was
Add contributing instructions (Resolves #12)
. -
Push your branch to GitHub. If you're pushing your branch for the first time, you'll have to set the upstream:
git push --set-upstream origin feature-branch-name
Otherwise, just push like usual:
git push origin feature-branch-name
If you forget the branch name:
- Run
git status
to see the branch you currently have checked out (among other things). - You can list existing branches with
git branch --list
.
- Run
-
Open a pull request [example].
- If you made multiple commits over a period of time, chances are high that your branch is behind the master branch. Follow these instructions to bring your local branch up to date with master on both your local and remote repository, run:
git checkout master git pull git checkout feature-branch-name git merge master git push
- Open the repo page in your web browser.
- If you want to see what the modifications look like before opening a pull request, you can go to the document you modified and change the branch to the left of the file name.
- Go to the pull requests tab and click
new pull request
. - Select your branch name to compare to master. If you forked the repo instead of making a branch, select
compare across forks
instead. - Create the pull request.
A maintainer will review your pull request and may ask you to make additional changes. If you have write access to the repo, don't merge your branch into master. The maintainer will merge it when they decide the branch is ready.
- If you made multiple commits over a period of time, chances are high that your branch is behind the master branch. Follow these instructions to bring your local branch up to date with master on both your local and remote repository, run:
-
Continue to pull, commit, & push changes on your branch to update the open pull request as needed.
-
Once a pull request is merged, the maintainer may delete the branch if it will no longer be needed in the future.