Fork & Branch Git WorkFlow

To create a PR (Pull Request), I used a Fork & Branch Git Workflow mentioned below:

Prerequisites:

Guidelines:

Terminologies:

Step 1: Fork the Repository

Step 2: Make a Local Clone

Step 3: Adding a Remote

Step 4: Working In a Branch

  1. Create and Checkout
  2. Method 1

    git branch {branch-name}

    git checkout {branch-name}

    OR

    Method 2 (shorthand for Method 1)

    git checkout -b {branch-name}

    Example: git checkout -b feature

    Executing either method creates & switches to the new branch i.e feature.

  3. Make changes to the files via any editor of your choice Any changes made will be in the feature branch, not main (formerly known as the master) a.k.a root branch.
  4. Commit those changes
  5. git add .

    git commit -m "{message}"

Step 5: Pushing changes to GitHub

Step 6: Opening a Pull Request

Step 7: Cleaning Up After a Merged PR

Step 8: Keeping your Forked Repo in Sync with the Original Repo