# Collaborative Workflow with Forking and Pull Requests

Let's go through a practical step by step process, from forking the repository to creating a feature branch, making changes, and finally submitting a pull request for review and merging.

#### <mark style="color:blue;">Scenario</mark>

Let's imagine that Alice, a developer, wants to contribute to an open-source project called "AwesomeApp." The project is hosted on a platform like GitHub, which supports the forking and pull request workflow.

#### Step 1: Forking the Repository&#x20;

To contribute to "AwesomeApp," Alice needs to fork the repository. Forking creates a copy of the project under Alice's GitHub account, allowing her to freely make changes without affecting the original codebase.

* Alice goes to the "AwesomeApp" repository on GitHub.
* She clicks on the "Fork" button in the top-right corner of the repository page.
* GitHub creates a copy of the repository under Alice's GitHub account.

#### Step 2: Cloning the Forked Repository&#x20;

After forking the repository, Alice needs to clone it to her local machine to start working on the changes.

* Alice opens a terminal on her machine.
* She uses the following Git command to clone the forked repository

```bash
git clone https://github.com/Alice/AwesomeApp.git
```

Note: Replace "Alice" with her GitHub username.

* The repository is now cloned to Alice's local machine.

#### Step 3: Creating a Feature Branch&#x20;

To make changes to the project, Alice should create a new branch dedicated to her feature or bug fix.

* Alice navigates into the cloned repository's directory:

```bash
cd AwesomeApp
```

* She creates a new branch, naming it descriptively:

```bash
git checkout -b alice-add-new-feature
```

This command creates and switches to the new branch, `alice-add-new-feature`

#### Step 4: Making Changes&#x20;

Now that Alice has created a feature branch, she can start making the desired changes to the codebase.

* Alice opens the code files using her preferred text editor or IDE.
* She makes the necessary modifications, adds new functionality, or fixes bugs.

#### Step 5: Committing Changes&#x20;

Once Alice has made the desired changes, she needs to commit them to the feature branch.

* Alice stages the changes she made:

```bash
git checkout -b alice-add-new-feature
```

* This command stages all the modified and new files for commit.
* She commits the changes with a descriptive message:

```bash
git commit -m "Add new feature: XYZ"
```

Replace "XYZ" with a brief description of the added feature.

#### Step 6: Pushing the Feature Branch&#x20;

After committing the changes locally, Alice needs to push the feature branch to her forked repository on GitHub.

* Alice pushes the feature branch:

```bash
git push origin alice-add-new-feature
```

* This command pushes the branch to Alice's forked repository.

#### Step 7: Creating a Pull Request&#x20;

Now that Alice has pushed her feature branch, she can open a pull request to propose the changes to the original "AwesomeApp" repository.

* Alice navigates to her forked repository on GitHub.
* She clicks on the "New Pull Request" button near the top of the repository page.
* GitHub compares the changes in Alice's feature branch with the main branch of the original repository.
* Alice reviews the changes, adds a descriptive title and comment, and clicks on the "Create Pull Request" button

#### Step 8: Review and Merge&#x20;

After Alice has created the pull request, the project maintainers will review her changes and decide whether to merge them into the main codebase.

* The maintainers of "AwesomeApp" receive a notification about the new pull request.
* They review the proposed changes, provide feedback, and discuss any necessary modifications with Alice through comments.
* Alice can continue making changes and pushing them to the feature branch based on the feedback until the pull request is approved.
* Once the maintainers are satisfied with the changes, they merge Alice's pull request into the main branch of "AwesomeApp."
* Alice's contribution is now a part of the project, and her feature is available to all users of "AwesomeApp."


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://gitdeveloperguide.solomonmarvel.com/working-with-remote-repositories/collaborating-with-git-practice-scenarios/collaborative-workflow-with-forking-and-pull-requests.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
