Skip to content

Instantly share code, notes, and snippets.

@peterkir
Created July 21, 2023 22:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterkir/e59fed896c1d59521fff50ca91f91fbe to your computer and use it in GitHub Desktop.
Save peterkir/e59fed896c1d59521fff50ca91f91fbe to your computer and use it in GitHub Desktop.
Github PR

A Git pull request is a feature used to propose changes to a codebase managed in a Git repository. It enables developers to collaborate, review, and discuss code changes before merging them into the main branch. The primary purpose of a pull request is to facilitate a structured code review process and maintain the quality and integrity of the codebase.

Here's a general procedure for creating and handling a Git pull request:

  1. Fork the Repository: If you don't have write access to the original repository, you need to fork it first. This creates a personal copy of the repository under your GitHub (or Git provider) account.

  2. Create a New Branch: In your local copy of the repository, create a new branch. Typically, this branch will be based on the main branch (e.g., 'master' or 'main').

  3. Make Code Changes: On the new branch, make the desired code changes, implementing bug fixes or adding new features.

  4. Commit Changes: After making the changes, commit them to the new branch with appropriate commit messages describing the purpose of each change.

  5. Push the Branch: Push the new branch with the committed changes to your forked repository on the Git provider (e.g., GitHub).

  6. Create the Pull Request: On the Git provider's website, navigate to your forked repository and click on the "New Pull Request" button. Select the branch with your changes as the compare branch and the main branch of the original repository as the base branch.

  7. Review the Pull Request: Other developers and team members can now review your changes in the pull request. They can provide comments, ask questions, and suggest improvements.

  8. Address Feedback: If there are any suggestions or issues raised during the review process, make the necessary changes and commit them to the same branch. The pull request will automatically be updated with the new changes.

  9. Merge the Pull Request: Once the pull request has been reviewed and approved by the team, it can be merged into the main branch of the original repository.

  10. Delete the Branch: After the pull request is merged, you can delete the branch used for the pull request since its changes are now part of the main branch.

The pull request workflow promotes collaboration, code quality, and knowledge sharing among developers working on the same project. It allows for a structured process of integrating changes while maintaining the stability of the codebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment