There are many ways to contribute to your team. With the help of GitHub, your collaboration will be more secure, efficient and asynchronous.
Clicking the following button (usually on top right corner) will duplicate the entire repository to your own account.
Check here about how to fork on GitHub Desktop.
Note: Please consider branching if you are working as a team. Check here for instructions about branching.
Instead of merging your contributions to master branch directly, it is better to make a pull request. A pull request proposes your changes and allows collaborators to review the changes by [code review](#Code Review)
You can make a pull request from a branch or a forked repository.
To make a pull request from a branch:
-
Navigate to your repository
-
It opens up a new page where you can add additional information for your pull request
-
Fill in the title
-
Write some comments if necessary
-
Select reviewers by clicking
Reviwers
and click `Create pull request
To make a pull request from a forked repository, start from the third point of making a pull request from a branch.
Check here for more information about creating a pull request from a fork.
The reviewers selected during making a pull request can review the code changes.
Click the File Changes
tab to list the changed files
Hover over the changed file, you can leave a comment by clicking the plus button
After finishing review, you can just leave some comments, approve the pull request or mark "Request changes".
Once every reviewer approves your pull request, you can try to merge your pull request.
Check here about pull request reviews.
Merging a pull request can merge the code changes to the destination branch. Different repositories have different rules for merging. Some may need at least one reviewer to approve your pull request. As our course progresses, it may also need a passing CI.
You can click the merge button to merge your pull request.
During merging, you may experience code conflicts.
Merge conflicts happen when you merge branches that have competing commits, and Git needs your help to decide which changes to incorporate in the final merge.
You have to make another commit to address the conflicts before merging. There are a variety of ways to resolve conflicts. The best way is to merge the base branch to your local branch, either Git or GitHub Desktop will let you know which have conflict issues. The conflicts will look like the following:
<<<<<< HEAD
Base change
=======
Local change
>>>>>> local-branch
In you text editor, you can choose to keep your local changes, keep base changes or merge them.