If you’ve been added as a collaborator, clone the project to your local machine:
git clone https://github.com/{project-owner}/{project-name}.git
Otherwise, fork the project (https://github.com/{project-owner}/{project-name}/fork), then clone your forked project to your local machine:
git clone https://github.com/{your-username}/{project-name}.git
Checkout dev
branch to create a new feature branch. Use the branch
naming scheme, dash-separated-feature-title-issue-no
:
git checkout dev git checkout -b add-logarithms-42
Stage and commit your changes with a present tense commit message - preferably one that’s no more than 50 characters in length and all lowercased (unless warranted, otherwise):
git add <files-to-be-staged> git commit -m "add logarithms"
Push new feature branch to origin:
git push origin add-logarithms-42
If you already have an in-progress feature branch in origin and your
dev
branch becomes out of date, fetch and rebase your working branch
off origin/dev
, then force push with lease:
Note: if you forked your project, you will first need to update the origin of your forked project
git fetch origin git rebase origin/dev git push origin add-logarithms-42 --force-with-lease
Update the origin of your forked project by first configuring a remote
that points to the original repository which we will call upstream
:
git remote add upstream https://github.com/{project-owner}/{project-name}.git
Fetch all changes from upstream
, checkout dev
branch, then rebase
off upstream/dev
to update your local dev
branch:
git fetch upstream git checkout dev git rebase upstream/dev
Force push changes to your forked origin:
git push -f origin dev
-
Submit a PR on GitHub, by setting your feature branch as the
head
branch anddev
as thebase
branch. -
Connect PR to its corresponding issue that it closes.
-
Assign a reviewer.
-
Reviewer will delete feature branch once it’s been merged.