Merge / Pull request (Git)

Is it a git feature?
First of all it isn’t a feature from git itself it’s provided by tools like Github and Gitlab.


What’s the reason?
The reason for that feature is to increase the quality assurance of the repository.


How does it work?
If contributors want to change something in a repository, they don’t have any right to push, they need to fork it first. Then they can create a branch on that fork with their changes and afterwards create a pull/merge request for it. Now the maintainers, who have the right to push, can discuss the changes and possible merge the changes onto the parent branch in the origin repository.

Git Server
   |-------------| --- 1) Fork Repo ----> |-------------| ---------|
   | Origin Repo |                        | Forked Repo |          |
   |-------------| <-- 6) Pull Request -- |-------------| <------------|
                                                                   |   |
                                                                   |   |
Local Machine (Contributor)                                        |   |
   |<-- 3) Create Branch ---- |-------------| <-- 2) Clone Repo ---|   |
   |                          | Cloned Repo |                          |
   |--- 4) Commit Changes --> |-------------| --- 5) Push Branch ------|