JoeS
JoeS

Reputation: 41

Git: replace commit history of Master with the history of feature branch

I'm new to interactive rebasing in Git so I made a branch where I could squash commits ( squash-branch ) just in case I ruined something. I didn't change any of the files on the branch, just the history. I merged the branch to master expecting that it would take the commit new commit history of the squash-branch.

How do I replace the commit history of master with squash-branch's history? To say it in a different mood, I want master to have squash-branch's history.

I've already tried two methods of force overwriting master with squash-history. The "ours strategy" and git branch -f master squash-branch.

Please notify if you need more details!

Thanks!

Upvotes: 0

Views: 182

Answers (1)

Ry-
Ry-

Reputation: 224952

git reset can do that:

git checkout master
git reset --soft squash-branch

Details in git-reset(1).

git reset [<mode>] [<commit>]

This form resets the current branch head to <commit>

Upvotes: 2

Related Questions