How Do I Change My Local Branch from Remote Master

Do a replace of the local branch with the changes from remote master.Follow the work flow that I get using Gitlab by creating a merge request and merge the changes from master branch into the branch that I wish to update to the latest from master.

How do I override a local branch with a remote master?

  1. Delete your local branch: git branch -d local_branch.
  2. Fetch the latest remote branch: git fetch origin remote_branch.
  3. Rebuild the local branch based on the remote one: git checkout -b local_branch origin/remote_branch.

How do I change my local master branch?

  1. Checkout the master branch locally.
  2. Run git pull –rebase origin master (This pulls down the most up-to-date changes on master locally)
  3. Checkout local branch say my_branch.
  4. Run git pull –rebase origin master (This updates your local branch against the most recent master on remote.
Elena Rostova

Elena Rostova

Lead Health, Wellness & Medical Journalist

Elena Rostova holds a Master's degree in Public Health Journalism. She covers groundbreaking medical research, holistic wellness trends, mental health awareness, and nutritional science.

Share this article
Twitter Facebook Pinterest