Photo credit: unsplash.com/s/photos/gi…
I wrote this article to learn more about how open source projects work with many people, and to deepen my understanding of Git code management.
github
Program to addcollaborators
Properties similar to the Team mode, the owner of a Repository can directly add Collaborators to his or her Repository, allowing the Collaborators to have permissions nearly equal to the owner.
Add members
Project owner A wants collaborator B to participate in the team development of the team, so A invites B and successfully adds B to the project so that B can contribute code as A collaborator.
Fork & Pull Request
Fork
The GitHub Fork is a clone of the repository on the server. It contains all the contents of the repository, such as branches, tags, and commits, as shown below
Pull Request
Pull Request is a notification mechanism. Pull Request is when you make changes to someone else’s code, notify the original author of your changes, and expect him to merge your changes.
To create aPull Request
First Fork the project code, git clone it, modify the code and push it up, and then create PR, as shown in the figure below.
So there is a projectPR
, as shown in the figure below.
As a manager of an open source project, you have a choicemerge
该 request
In your own project, you can also choose to close the request.
Merging branches
It is inevitable to merge branches when working with multiple people. Here is a brief description of the basic operation of branches. Git checkout -b A, create and switch to branch A. Suppose we finish the code in branch A. Git pull origin master = git pull origin master = git pull origin master Git push Origin master commit to remote repository by using git merge A
git rebase
Git rebase is a command I often use in my work. For example, when I have written code in dev branch, I will switch branch to master to pull the latest remote code. Git merge dev/master/master/master/master/master/master/master/master Finally, git push will upload the commit of the master branch.
Code Review
Commits to record
Code Review can be viewed through the COMMITS history, and comments can be added based on the Code change history, as shown in the figure below.
pull requests
The resources
Git & GitHub: How to collaborate on multi-person projects