🗺️
Labs Engineering Guide
HomeStandards
  • Labs Engineering Guide
  • Always Read This First!
  • Product
    • Product Roadmap
    • Planning Your Product
      • Jira
      • User Stories & Tasks
      • Daily Standups
  • Coding
    • Git Workflow
    • Git Rebase
    • Linting and Formatting
    • Environment Variables
  • GitHub
    • Github FAQ
    • GitHub Basics
    • Github Actions
    • Github/Jira Integration
  • AWS
    • AWS Basics
    • AWS Networking
    • Amplify
      • Amplify DNS
      • Amplify Deployment
    • Elastic Beanstalk
      • Elastic Beanstalk DNS
  • Heroku
    • Heroku Basics
    • Heroku Node Deployment
    • Heroku Networking
    • Heroku Pipelines
    • Heroku Review Apps
  • Okta
    • Okta Basics
      • Okta Application Setup
Powered by GitBook
On this page
  • Rebasing a feature branch from main
  • Objective
  • Getting Started

Was this helpful?

  1. Coding

Git Rebase

PreviousGit WorkflowNextLinting and Formatting

Last updated 3 years ago

Was this helpful?

Rebasing a feature branch from main

On occassion you'll find that you've been working on a feature branch and you need to merge in changes from main. This could just be a final step before you push a series of commits to github before creating a PR.

These steps are similar to what the "Rebase and Merge" action does on github.

Objective

This guide will show you how to rebase (rebuild) a feature branch to begin at the current HEAD of the main branch. Think of it as if you are starting a new branch based on the current main and pasting all of your commits to the new branch.

Never rebase a branch that has already been pushed to a remote (public, eg. the main branch) repository, such as github; doing so will cause conflicts and confusion among your team.

Technologies

  • git cli

References

Getting Started

  1. Make sure all changes are committed to your feature branch

  2. You will need to update your local main branch

    • > git checkout main

    • > git pull origin main

  3. Go back to your feature branch

    • > git checkout feature-branch

  4. Now we can rebase the feature branch onto main

    git rebase main First, rewinding head to replay your work on top of it... Applying: added staged command

  5. Your commits will now show in the git log after the commits merged from main

The Pro Git book
bitbucket tutorials