Skip to content

How to work off of a feature branch

Josh Bubar edited this page Jul 14, 2021 · 14 revisions

This guide describes how to set up a local branch while working off of a feature branch.

Step 1: Create your branch

  • Fetch the most recent changes on the upstream remote

    git fetch upstream
  • Create the local branch off of the upstream remote branch

    # example: git checkout wins-feature-1 upsream/wins-feature-1
    # {FEATURE BRANCH NAME} needs to be identical to the feature branch name on the upstream remote repo
    git checkout {FEATURE BRANCH NAME} upstream/{FEATURE BRANCH NAME}
  • Create your new branch off of the new feature branch that you just created!!

    git checkout -b {YOUR BRANCH}

Step 2: Update your branch with upstream changes

  • Update the branch with the latest changes using the following command
    # example: git pull upstream wins-feature-1
    git pull {NAME OF REMOTE} {NAME OF REMOTE BRANCH}

Step 3: Create a pull request

  • Stage and commit your changes
    git add {FILES CHANGED}
    git commit -m "{COMMIT MESSAGE}"
  • Push changes to your remote
    # this is the same as always
    git push origin {NAME OF YOUR LOCAL BRANCH}
  • Create a pull request that is comparing across forks, from your branch to the feature branch
Clone this wiki locally