Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 792181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:57:09+00:00 2026-05-14T21:57:09+00:00

I have two branches in my Git repository: master seotweaks (created originally from master

  • 0

I have two branches in my Git repository:

  1. master
  2. seotweaks (created originally from master)

I created seotweaks with the intention of quickly merging it back into master. However, that was three months ago and the code in this branch is 13 versions ahead of master.

It has effectively become our working master branch as all the code in master is more or less obsolete now.

Very bad practice I know, lesson learned.

Do you know how I can replace all of the contents of the master branch with those in seotweaks?

I could just delete everything in master and merge, but this does not feel like best practice.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T21:57:09+00:00Added an answer on May 14, 2026 at 9:57 pm

    You should be able to use the “ours” merge strategy to overwrite master with seotweaks like this:

    git checkout master
    git pull
    git checkout seotweaks
    git merge -s ours master
    git checkout master
    git merge seotweaks
    

    The first two steps are a useful precaution to ensure your local copy of master is up-to-date. The result should be that your master is now essentially seotweaks.

    (-s ours is short for --strategy=ours)

    From the docs about the ‘ours’ strategy:

    This resolves any number of heads, but the resulting tree of the merge is always that of the current branch head, effectively ignoring all changes from all other branches. It is meant to be used to supersede old development history of side branches. Note that this is different from the -Xours option to the recursive merge strategy.

    Update from comments: If you get fatal: refusing to merge unrelated histories, then change the second line to this: git merge --allow-unrelated-histories -s ours master

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a git repository (at github.com) with two branches: master and gh-pages. I
So we've gotten a git branch into a tricky state: Two branches: * master
I have two branches: master and dev I want to create a "feature branch"
I have a repository with branches master and A and lots of merge activity
I have a repository with two branches: live and stage. The repository holds code
We have two branches: 1. HEAD - the latest version (AKA Trunc) 2. PROD
I have two branches : X and Y. I want to replace a Y's
Suppose I have two branches of a project IMClient-MacOS and IMClient-Windows, and their code
I have two identical tables and need to copy rows from table to another.
I have a git repository that I am using and I've screwed up. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.