1
Core Concept: GitHub Pull Requests (PRs)**
* Pull Requests are fundamental for team-based development workflows on GitHub.
* They enable code review, discussion, and controlled merging of new features or fixes into the main codebase (typically the `master` branch).
2
Step-by-Step Workflow for Feature Branches and Pull Requests:**
1. **Synchronize Your Local Master Branch:**
* Always begin by pulling the latest changes from the remote `master` branch to ensure your local `master` is up-to-date: `git pull`.
2. **Create a New Feature Branch:**
* Branch off from your `master` branch to isolate your specific feature or bug fix: `git branch your-feature-name`.
3. **Develop and Commit Your Changes:**
* Implement your code modifications within your new feature branch.
* Add your modified or new files to the staging area: `git add .` (or specify individual files).
* Commit your changes with a clear and descriptive message: `git commit -m "Your descriptive commit message"`.
4. **Integrate Master Branch into Your Feature Branch (Pre-PR):**
* Before pushing your feature branch, pull the latest `master` branch again.
* Merge the `master` branch into your feature branch to resolve any potential conflicts locally and early: `git merge master`.
* *Note:* This step is crucial for handling merge conflicts before submitting the PR.
5. **Push Your Feature Branch to GitHub:**
* Push your local feature branch to your remote GitHub repository: `git push origin your-feature-name`.
6. **Submit a Pull Request:**
* Navigate to your repository on GitHub. GitHub will often prompt you to create a pull request from your newly pushed branch.
* Submit a new Pull Request, typically targeting the `master` branch as the base.
7. **Collaborate, Discuss, and Merge:**
* The Pull Request serves as a platform for team members to comment, review code, and suggest further changes.
* You can push additional commits to your feature branch, and they will automatically update the open PR.
* Once the code is reviewed, approved, and all discussions are resolved, the Pull Request can be merged into the `master` branch, integrating your changes into the main codebase.