Pull Requests and GitHub Workflow
A Pull Request (PR) is a way for developers to notify repository maintainers about changes they have made in a branch, suggesting that those changes should be merged into the main codebase.
It is a structured way to propose, review, and merge changes in a collaborative Git workflow, functioning like a managed push and pull process for code contributions.
Note - Pull Requests Are Not Core Git but heavily used in platforms like Github, GitLab etc
The standard GitHub Workflow is:
-
Fork the repository (if needed)
If you don’t have write access to the original repository, you first need to fork it to your GitHub account.
-
Clone the repository
git clone <repo-url> cd <repo-name>
-
Create a new branch for your changes
git checkout -b feature-branch
-
Make changes and commit them
git add . git commit -m "Added new feature"
-
Push the changes to your remote repository
git push origin feature-branch
-
Open a Pull Request on GitHub
After that developers/maintainers will discuss and if they find everything to be okay, they will merge it.
git checkout main git merge feature-branch