I want to...replace the content of my master
with what's in [feature
]
Sounds like you don't want to merge at all. I would do this:
git checkout master
git tag old-master
git reset --hard feature
A branch in git is not a container for files: It's nothing but a name for a particular commit.
The git checkout master
command does two things;
- It makes the workspace look like whatever the
master
commit says it's supposed to look like, but we don't care about that, and
- It makes
master
be the "current" branch.
The git tag old-master
command is optional: It makes a new name (old-master
) for the commit that's about to not be master
anymore, just in case you might ever want to find it again.
git reset --hard feature
is the money command: It does two things;
- It changes the current branch (
master
) to refer to the same commit that feature
refers to, and
- It re-checks it out, making the workspace look like what the master/feature commit says it should look like.